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

only apply updates for entities from the current packet

This commit is contained in:
Robin Appelman 2017-02-13 18:55:26 +01:00
commit 7cb74d93de
8 changed files with 46 additions and 50 deletions

View file

@ -1,18 +1,16 @@
import {PacketEntitiesPacket} from "../Data/Packet";
import {Match} from "../Data/Match";
import {Entity} from "../Data/Entity";
import {PacketEntity} from "../Data/PacketEntity";
import {Vector} from "../Data/Vector";
import {Player} from "../Data/Player";
export function handlePacketEntities(packet: PacketEntitiesPacket, match: Match) {
for (const entity of match.entities) {
if (entity) {
handleEntity(entity, match);
}
for (const entity of packet.entities) {
handleEntity(entity, match);
}
}
function handleEntity(entity: Entity, match: Match) {
function handleEntity(entity: PacketEntity, match: Match) {
switch (entity.serverClass.name) {
case 'CWorld':
match.world.boundaryMin = <Vector>entity.getProperty('DT_WORLD', 'm_WorldMins').value;