1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

reset buildings on round start

This commit is contained in:
Robin Appelman 2017-03-05 15:22:01 +01:00
commit dfce4fd6a1

View file

@ -38,7 +38,7 @@ export function handleGameEvent(packet: GameEventPacket, match: Match) {
} }
break; break;
case 'player_spawn': { case 'player_spawn': {
const values = <PlayerSpawnEventValues>packet.event.values; const values = <PlayerSpawnEventValues>packet.event.values;
const userId = values.userid; const userId = values.userid;
const userState = match.getUserInfo(userId); const userState = match.getUserInfo(userId);
const player = match.playerMap[userState.entityId]; const player = match.playerMap[userState.entityId];
@ -54,9 +54,13 @@ export function handleGameEvent(packet: GameEventPacket, match: Match) {
userState.classes[classId]++; userState.classes[classId]++;
} }
break; break;
case 'object_destroyed':{ case 'object_destroyed': {
const values = <ObjectDestroyedValues>packet.event.values; const values = <ObjectDestroyedValues>packet.event.values;
delete match.buildings[values.index]; delete match.buildings[values.index];
} }
break;
case 'teamplay_round_start':
match.buildings = {};
break;
} }
} }