fix: lobby ownership, duplicate locations, hook hologram, TP hooked players back
This commit is contained in:
parent
183df22d13
commit
2706d6d123
7 changed files with 75 additions and 9 deletions
|
|
@ -27,13 +27,34 @@ public class GameplayHookHandler {
|
|||
this.hookRecovery = hookRecovery;
|
||||
}
|
||||
|
||||
private int hookTpTick;
|
||||
|
||||
/**
|
||||
* Called every tick - checks hook stage progression.
|
||||
* Called every tick - checks hook stage progression and teleports hooked players back.
|
||||
*/
|
||||
public void tick() {
|
||||
// HookManager handles its own ticking via startTicking()
|
||||
// We just need to check stage transitions here
|
||||
checkHookStages();
|
||||
hookTpTick++;
|
||||
if (hookTpTick >= 20) {
|
||||
hookTpTick = 0;
|
||||
tpHookedBack();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Teleport hooked survivors back to their hook if they've moved too far.
|
||||
*/
|
||||
private void tpHookedBack() {
|
||||
for (Hook hook : hookManager.getAllHooks()) {
|
||||
if (!hook.isOccupied()) continue;
|
||||
Survivor hooked = hook.getHookedSurvivor();
|
||||
if (hooked == null) continue;
|
||||
Player p = hooked.getPlayer();
|
||||
if (p == null || !p.isOnline()) continue;
|
||||
if (p.getLocation().distanceSquared(hook.getLocation()) > 1.0) {
|
||||
p.teleport(hook.getLocation().clone().add(0.5, 0, 0.5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue