source-sdk-2013
source-sdk-2013 copied to clipboard
[HL2] npc_combinedropship with a strider crate type crashes on spawn
Describe the bug
A npc_combinedropship
entity with its CrateType
keyvalue set to CRATE_STRIDER
causes an access violation on spawn due to an invalid model pointer. This is on the latest version of the Source 2013 master
branch.
Steps to reproduce
Steps to reproduce the behavior:
- Load a map with a dropship carrying a strider crate, or create a dropship entity with this crate type manually by using the following command:
ent_create npc_combinedropship CrateType -1
- Game will crash due to the dropship having an invalid model pointer while setting up the strider's bones, specifically while the strider is executing
MoveToGround
.
Expected behavior
npc_combinedropship
should be able to use this crate type without crashing the game. Half-Life 2 itself uses dropships with the strider crate type in d3_c17_04
, d3_c17_05
, d3_c17_09
, d3_c17_11
, and d3_c17_13
.
Additional context
This seems to be related to SetModel
being moved from before to after m_hContainer
is created (#L977) in the recent commit. Moving it back to before the container is spawned fixes the issue. Alternatively, moving the SetParent()
call on the strider (#L905) to after its Spawn()
call also seems to fix the issue, as the strider no longer requires the dropship's model pointer.