I'm trying to create a custom weapon entity based on weapon_sg556 in CSGO.
I hooked CreateEntityByName function and replace my custom classname "weapon_custom" to "weapon_sg556" in the function parameters.
After the weapon is spawned, players can't pick it up. I checked the sendprops and found that m_bInitialized is false, for normal weapon_sg556 that value false in postcreate and is true in prespawn hook.
I checked the source code and found that this function should be called before spawn to set some parameters and m_bInitialized to true:
Code:
void CEconItemView::Init( int iDefIndex, int iQuality, int iLevel, uint32 iAccountID )
but for my custom weapon it newer happens, whichever way I try to create it: via smx, give command or stripper.
The engine somehow knows that the original classname is another, not weapon_sg556 and prevents weapon initialisation.
Form the source code it's not clear where Init( is called from. My questions:
1) How CEconItemView gets initialised for ordinary weapons?
2) Can I somehow debug it, or does anobody know what could be the reason?
3) Can I somehow initialise CEconItemView?