From fbb53d62f4d1b5dd5f2ce90ea5fd29341538b9cc Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 20 Jan 2022 14:27:39 -0800 Subject: [PATCH] prop_dynamic: Filter the 'solid' field by its 3 supported collision types. --- src/gs-entbase/server/prop_dynamic.qc | 28 +++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gs-entbase/server/prop_dynamic.qc b/src/gs-entbase/server/prop_dynamic.qc index 1d610452..5a255bfe 100644 --- a/src/gs-entbase/server/prop_dynamic.qc +++ b/src/gs-entbase/server/prop_dynamic.qc @@ -22,6 +22,7 @@ Client-side decorative model entity. "modelscale" : Scale modifier of the model. Default is "1". "angles" : Sets the pitch, yaw and roll angles of the model. "_cs" : Toggles if the prop casts a shadow or not. +"solid" : Specifies which collision model to use (0: Nonsolid; 2: BBox; 6: Per-poly) -------- TRIVIA -------- This entity was introduced in Half-Life 2 (2004). @@ -34,6 +35,7 @@ class prop_dynamic:NSSurfacePropEntity void(void) prop_dynamic; virtual void(void) Respawn; + virtual void(string, string) SpawnKey; }; void @@ -44,8 +46,30 @@ prop_dynamic::Respawn(void) if (spawnflags & PRPDYN_NONSOLID) SetSolid(SOLID_NOT); - else - SetSolid(SOLID_BBOX); +} + +void +prop_dynamic::SpawnKey(string strKey, string strValue) +{ + switch (strKey) { + case "solid": + float s = stof(strValue); + + switch (s) { + case 0: + SetSolid(SOLID_NOT); + break; + case 2: + SetSolid(SOLID_BBOX); + break; + case 6: + SetSolid(SOLID_BSP); + break; + } + break; + default: + super::SpawnKey(strKey, strValue); + } } void