Closed mage-tearz closed 1 month ago
If this somehow isn't a bug with the game and is intentional, is there a workaround for it? Some way to initialize the model's sequences and/or attachments without this happening?
This is because there's a lot of spaghetti code when it comes to source weapons, while the weapon entity itself renders as the world model, its actually internally set to the "viewmodel model" most of the time, NOT the "worldmodel model". This happens when player equips the weapon.
You calling Entity:SetModel stomps that out, so serverside, when playing stuff like ACT_VM_RELOAD
, it will search for that activity on the world model now (which doesn't have that activity), instead of the view model. You will notice that calling local wep = Entity(1):GetActiveWeapon() wep:SetModel( wep:GetWeaponViewModel() )
makes it work properly again.
Thanks for explaining, i'll test it when I'm available. There's no way I would've figured that out without you telling me.
Details
Setting the model of an active weapon causes its viewmodel sequences to mess up. By 'mess up' I mean they all become instant and the animations play as though they don't exist. This is being done with the base Half-Life 2 weapons. I am on the x86-64 branch, this is the version info:
No console output is shown when running the below Lua script. Printing both the weapon's viewmodel and worldmodel clientside and serverside both return the proper results.
Steps to reproduce
wep:SetModel( wep:GetModel() )