|
|
@@ -21,9 +21,9 @@ class unitTracker {
|
|
|
constructor(deps) {
|
|
|
const mod = deps.mod;
|
|
|
const proto = deps.proto;
|
|
|
-
|
|
|
+
|
|
|
console.log("DEBUG: unitTracker -> constructor");
|
|
|
-
|
|
|
+
|
|
|
// portals "shapeId": 652992,
|
|
|
// ninja log "shapeId": 303030
|
|
|
// sentinel "shapeId": 730500
|
|
|
@@ -83,8 +83,26 @@ class unitTracker {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const userMounted = (type, event) => {
|
|
|
+ if (this.users.has(event.gameId)) {
|
|
|
+ let data = undefined;
|
|
|
+ switch (type) {
|
|
|
+ case (ENTITY_HOOK_TYPE.DESPAWN):
|
|
|
+ data = this.users.get(event.gameId);
|
|
|
+ data.mount = 0;
|
|
|
+ this.users.set(event.gameId, data);
|
|
|
+ break;
|
|
|
+ case (ENTITY_HOOK_TYPE.SPAWN):
|
|
|
+ data = this.users.get(event.gameId);
|
|
|
+ data.mount = event.id;
|
|
|
+ this.users.set(event.gameId, data);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
const updateAngle = (data, w) => data.loc.w = w;
|
|
|
-
|
|
|
+
|
|
|
const updateLoc = (data, loc) => data.loc = loc;
|
|
|
|
|
|
const updateAngleHandler = (event) => {
|
|
|
@@ -94,7 +112,7 @@ class unitTracker {
|
|
|
else if (this.summons.has(gameId)) this.summons.set(gameId, updateAngle(this.summons.get(gameId), event.w));
|
|
|
};
|
|
|
|
|
|
-
|
|
|
+
|
|
|
const userLocationHandler = (event) => {
|
|
|
if (this.users.has(event.gameId)) {
|
|
|
this.users.set(event.gameId, updateLoc(this.users.get(event.gameId), event.loc));
|
|
|
@@ -136,11 +154,8 @@ class unitTracker {
|
|
|
mod.hook(...proto.getData("S_NPC_LOCATION"), HOOK_SETTINGS.FIRST, npcLocationHandler);
|
|
|
mod.hook(...proto.getData("S_USER_LOCATION"), HOOK_SETTINGS.FIRST, userLocationHandler);
|
|
|
mod.hook(...proto.getData("S_USER_LOCATION_IN_ACTION"), HOOK_SETTINGS.FIRST, userLocationHandler);
|
|
|
-
|
|
|
- //mod.hook("S_ACTION_STAGE", HOOK_SETTINGS.FIRST, locFromAction);
|
|
|
- //mod.hook("S_ACTION_END", HOOK_SETTINGS.FIRST, locFromAction);
|
|
|
- //mod.hook(...def.getVersion("S_EACH_SKILL_RESULT"), HOOK_SETTINGS.FIRST, eachResultUpdate);
|
|
|
-
|
|
|
+ mod.hook(...proto.getData("S_MOUNT_VEHICLE"), HOOK_SETTINGS.FIRST, userMounted.bind(null, ENTITY_HOOK_TYPE.SPAWN));
|
|
|
+ mod.hook(...proto.getData("S_UNMOUNT_VEHICLE"), HOOK_SETTINGS.FIRST, userMounted.bind(null, ENTITY_HOOK_TYPE.SPAWN));
|
|
|
|
|
|
mod.hook(...proto.getData("S_SPAWN_NPC"), HOOK_SETTINGS.FIRST, npcHandler.bind(null, ENTITY_HOOK_TYPE.SPAWN));
|
|
|
mod.hook(...proto.getData("S_DESPAWN_NPC"), HOOK_SETTINGS.FIRST, npcHandler.bind(null, ENTITY_HOOK_TYPE.DESPAWN));
|