Skip to content

Commit

Permalink
1.2.2: fix tracker going out of sync on players
Browse files Browse the repository at this point in the history
  • Loading branch information
deltanedas committed Jun 4, 2020
1 parent cc90170 commit 38cb230
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "[#00aaff]Tracker",
"author": "DeltaNedas",
"description": "Create easily visible markers to track a position or player.\n[stat]Requires [#00aaff]DeltaNedas/ui-lib[].",
"version": "1.2.1",
"version": "1.2.2",
"dependencies": ["ui-lib"],
"hidden": true
}
8 changes: 7 additions & 1 deletion scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const marker = new JavaAdapter(BulletType, {
Draw.color();
},

init(b) {},
init(b) {print("added one")},
collides: (b, t) => false,
hit(b, x, y) {
Log.error("Marker hit something, should never ever happen.");
Expand All @@ -118,6 +118,12 @@ ui.addTable("top", "tracker", table => {
// Only hook world load event and load sprite once
ui.once(() => {
Events.on(EventType.WorldLoadEvent, run(() => {
// Refresh the target's Player object
if (tracking instanceof Player) {
Core.app.post(run(() => {
tracking = Vars.playerGroup.getByID(tracking.id);
}));
}
Bullet.create(marker, Vars.player, 0, 0, 0);
}));
region = Core.atlas.find("shell-back");
Expand Down

0 comments on commit 38cb230

Please sign in to comment.