1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-03 16:44:12 +02:00

fix entrance detection

This commit is contained in:
Robin Appelman 2017-03-05 15:13:14 +01:00
commit 88d4815bae
2 changed files with 17 additions and 6 deletions

View file

@ -9,6 +9,7 @@ export interface BaseBuilding {
isBuilding: boolean; isBuilding: boolean;
isSapped: boolean; isSapped: boolean;
team: number; team: number;
angle: number;
} }
export interface Sentry extends BaseBuilding { export interface Sentry extends BaseBuilding {

View file

@ -208,7 +208,8 @@ function handleEntity(entity: PacketEntity, match: Match) {
position: new Vector(0, 0, 0), position: new Vector(0, 0, 0),
shieldLevel: 0, shieldLevel: 0,
isMini: false, isMini: false,
team: 0 team: 0,
angle: 0
}; };
} }
const sentry = <Sentry>match.buildings[entity.entityIndex]; const sentry = <Sentry>match.buildings[entity.entityIndex];
@ -233,6 +234,10 @@ function handleEntity(entity: PacketEntity, match: Match) {
break; break;
case 'DT_BaseObject.m_bMiniBuilding': case 'DT_BaseObject.m_bMiniBuilding':
sentry.isMini = <number>prop.value > 1; sentry.isMini = <number>prop.value > 1;
break;
case 'DT_TFNonLocalPlayerExclusive.m_angEyeAngles[1]':
sentry.angle = <number>prop.value;
break;
} }
} }
if (entity.pvs & PVS.LEAVE) { if (entity.pvs & PVS.LEAVE) {
@ -252,7 +257,8 @@ function handleEntity(entity: PacketEntity, match: Match) {
position: new Vector(0, 0, 0), position: new Vector(0, 0, 0),
team: 0, team: 0,
healing: [], healing: [],
metal: 0 metal: 0,
angle: 0
}; };
} }
const dispenser = <Dispenser>match.buildings[entity.entityIndex]; const dispenser = <Dispenser>match.buildings[entity.entityIndex];
@ -289,6 +295,7 @@ function handleEntity(entity: PacketEntity, match: Match) {
rechargeTime: 0, rechargeTime: 0,
rechargeDuration: 0, rechargeDuration: 0,
timesUsed: 0, timesUsed: 0,
angle: 0,
yawToExit: 0 yawToExit: 0
}; };
} }
@ -310,10 +317,10 @@ function handleEntity(entity: PacketEntity, match: Match) {
teleporter.otherEnd = <number>prop.value; teleporter.otherEnd = <number>prop.value;
break; break;
case 'DT_ObjectTeleporter.m_flYawToExit': case 'DT_ObjectTeleporter.m_flYawToExit':
if (prop.value) { teleporter.yawToExit = <number>prop.value;
teleporter.isEntrance = true; break;
teleporter.yawToExit = <number>prop.value; case 'DT_BaseObject.m_iObjectMode':
} teleporter.isEntrance = <number>prop.value === 0;
break; break;
} }
} }
@ -471,5 +478,8 @@ function applyBuildingProp(building: Building, prop: SendProp, propName: string)
case 'DT_BaseEntity.m_iTeamNum': case 'DT_BaseEntity.m_iTeamNum':
building.team = <number>prop.value; building.team = <number>prop.value;
break; break;
case 'DT_BaseEntity.m_angRotation':
building.angle = (<Vector>prop.value).y;
break;
} }
} }