Skip to content

Commit 45a30cb

Browse files
committed
Fix propcombine sometimes removing collisions entirely from component props
1 parent 4d81357 commit 45a30cb

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* Allow `comp_vactube_start` to be set to have a timer which starts disabled.
66
* If required, add various QC flags like `$mostlyopaque` to propcombined props.
77
* Limit the size of propcombined groups to avoid hitting vertex limits.
8-
* Prevent automatically packing models specified only as previews in various entities.
8+
* Prevent automatically packing models specified only as Hammer previews in various entities.
9+
* Fix propcombine sometimes removing collisions entirely from component props.
910

1011
--------------------
1112

src/hammeraddons/propcombine.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@
4040
LOGGER = get_logger(__name__)
4141

4242

43+
class CollType(Enum):
44+
"""Collision types that static props can have."""
45+
NONE = 0 # No collision
46+
BSP = 1 # Treat the same as MODEL.
47+
BBOX = 2
48+
OBB = 3
49+
OBB_YAW = 4
50+
VPHYS = 6 # Collision model
51+
52+
4353
@attrs.frozen
4454
class QC:
4555
path: str # QC path.
@@ -78,7 +88,7 @@ class QC:
7888
# Cache of the SMD models we have already parsed, so we don't need
7989
# to parse them again. For the collision model, we store them pre-split.
8090
_mesh_cache: ACache[Tuple[QC, int], Mesh] = ACache()
81-
_coll_cache: ACache[Optional[str], List[Mesh]] = ACache()
91+
_coll_cache: ACache[Tuple[Optional[str], CollType], List[Mesh]] = ACache()
8292

8393
# Limit the amount of decompile/recompiles we do simultaneously.
8494
LIM_PROCESS = trio.CapacityLimiter(8)
@@ -153,16 +163,6 @@ def check(point: Vec) -> bool:
153163
return check
154164

155165

156-
class CollType(Enum):
157-
"""Collision types that static props can have."""
158-
NONE = 0 # No collision
159-
BSP = 1 # Treat the same as MODEL.
160-
BBOX = 2
161-
OBB = 3
162-
OBB_YAW = 4
163-
VPHYS = 6 # Collision model
164-
165-
166166
@attrs.frozen
167167
class PropPos:
168168
"""Key used to match models to each other."""
@@ -330,7 +330,7 @@ async def compile_func(
330330
assert mdl is not None, prop.model
331331

332332
child_ref = await _mesh_cache.fetch((qc, prop.skin), build_reference, prop, qc, mdl)
333-
child_coll = await _coll_cache.fetch(qc.phy_smd, build_collision, qc, prop, child_ref, volume_tolerance > 0)
333+
child_coll = await _coll_cache.fetch((qc.phy_smd, prop.solidity), build_collision, qc, prop, child_ref, volume_tolerance > 0)
334334

335335
scale = Vec(prop.scale_x, prop.scale_y, prop.scale_z)
336336
offset = Vec(prop.x, prop.y, prop.z)

0 commit comments

Comments
 (0)