@@ -39,7 +39,11 @@ import {
3939import { isQuakeDebugHooksEnabled } from "./runtime/debug/quakeDebug" ;
4040import { createQuakeDebugRecorder } from "./runtime/debug/recording" ;
4141import { markQuakeTrace } from "./runtime/debug/traceMarks" ;
42- import { shouldSpawnQuakeEntityForCurrentGame , shouldSpawnQuakeEntityForGameMode } from "./runtime/entities" ;
42+ import {
43+ quakeEntityNumber ,
44+ shouldSpawnQuakeEntityForCurrentGame ,
45+ shouldSpawnQuakeEntityForGameMode ,
46+ } from "./runtime/entities" ;
4347import {
4448 applyQuakeInventoryDelta ,
4549 changeQuakeInventoryWeaponByImpulse ,
@@ -1013,12 +1017,13 @@ function quakeMultiplayerMenuRoomId(
10131017 mapName : string ,
10141018 forceNew : boolean ,
10151019) : string {
1020+ const staticRoomId = quakeMultiplayerStaticRoomIdForMap ( mapName ) ;
10161021 if (
10171022 ! forceNew &&
1018- QUAKE_MULTIPLAYER_ROOM_ID &&
1023+ staticRoomId &&
10191024 mapName === currentMapName
10201025 ) {
1021- return QUAKE_MULTIPLAYER_ROOM_ID ;
1026+ return staticRoomId ;
10221027 }
10231028 if (
10241029 ! forceNew &&
@@ -1093,6 +1098,13 @@ function quakeMultiplayerFallbackRoomId(mapName: string): string {
10931098 return roomId ;
10941099}
10951100
1101+ function quakeMultiplayerStaticRoomIdForMap ( mapName : string ) : string | null {
1102+ if ( ! QUAKE_MULTIPLAYER_ROOM_ID ) return null ;
1103+ const normalizedMapName = mapName . trim ( ) . toLowerCase ( ) ;
1104+ if ( quakeMultiplayerCompactInvite && normalizedMapName !== quakeMultiplayerCompactInvite . mapName ) return null ;
1105+ return QUAKE_MULTIPLAYER_ROOM_ID ;
1106+ }
1107+
10961108interface QuakeMultiplayerCompactInvite {
10971109 mapName : string ;
10981110 roomId : string ;
@@ -2185,7 +2197,7 @@ function* quakeDamageableBrushWeaponTargets(): Iterable<QuakeWeaponShootableTarg
21852197 for ( const entry of quakeDamageableBrushes . snapshot ( ) . brushes ) {
21862198 if ( entry . health <= 0 ) continue ;
21872199 const entity = entityByIndex . get ( entry . entityIndex ) ;
2188- if ( ! entity || entity . classname !== "func_button" || entity . modelIndex === undefined ) continue ;
2200+ if ( ! entity || ! quakeDamageableBrushCanBeWeaponTarget ( entity ) || entity . modelIndex === undefined ) continue ;
21892201 const model = sceneResult . models . find ( ( item ) => item . index === entity . modelIndex ) ;
21902202 if ( ! model ) continue ;
21912203 const min : Vec3 = [
@@ -2210,6 +2222,14 @@ function* quakeDamageableBrushWeaponTargets(): Iterable<QuakeWeaponShootableTarg
22102222 } ;
22112223 }
22122224}
2225+
2226+ function quakeDamageableBrushCanBeWeaponTarget ( entity : QuakeEntity ) : boolean {
2227+ if ( quakeEntityNumber ( entity , "health" , 0 ) <= 0 ) return false ;
2228+ return entity . classname === "func_button" ||
2229+ entity . classname === "trigger_multiple" ||
2230+ entity . classname === "trigger_once" ||
2231+ entity . classname === "trigger_secret" ;
2232+ }
22132233const quakeMultiplayerWorldRequestAt = new Map < string , number > ( ) ;
22142234let quakeMultiplayerLastRoomEvent : Record < string , unknown > | null = null ;
22152235let quakeMultiplayerRecentRoomEvents : Record < string , unknown > [ ] = [ ] ;
@@ -3532,7 +3552,7 @@ function applyQuakeMultiplayerInitialSpawnHint(): void {
35323552}
35333553
35343554function quakeMultiplayerRoomId ( roomKey : QuakeMultiplayerRoomCompatibilityKey ) : string {
3535- return QUAKE_MULTIPLAYER_ROOM_ID || quakeMultiplayerFallbackRoomId ( roomKey . mapName ) ;
3555+ return quakeMultiplayerStaticRoomIdForMap ( roomKey . mapName ) ?? quakeMultiplayerFallbackRoomId ( roomKey . mapName ) ;
35363556}
35373557
35383558function quakeMultiplayerMatchSettings ( ) : { fragLimit : number ; maxPlayers : number } {
@@ -3617,7 +3637,7 @@ function quakeMultiplayerDebugSnapshot(): Record<string, unknown> {
36173637 transport : QUAKE_MULTIPLAYER_TRANSPORT ,
36183638 partyHost : QUAKE_MULTIPLAYER_TRANSPORT === "party" ? QUAKE_MULTIPLAYER_PARTY_HOST : null ,
36193639 clientId : QUAKE_MULTIPLAYER_LOCAL_CLIENT_ID ,
3620- roomId : QUAKE_MULTIPLAYER_ROOM_ID || quakeMultiplayerFallbackRoomId ( currentMapName ) ,
3640+ roomId : quakeMultiplayerStaticRoomIdForMap ( currentMapName ) ?? quakeMultiplayerFallbackRoomId ( currentMapName ) ,
36213641 localPingMs : quakeMultiplayerLocalPingMs ,
36223642 sessionState : status . state ,
36233643 sessionMode : status . mode ,
0 commit comments