From 50bf37500610a6cce13fff452725853dcf7f9593 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Mon, 17 Mar 2025 09:04:33 -0500 Subject: [PATCH] update loaded players on screen --- src/engine/objects/PlayerCharacter.java | 40 ++++++++++++------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/engine/objects/PlayerCharacter.java b/src/engine/objects/PlayerCharacter.java index 471a3222..75859b70 100644 --- a/src/engine/objects/PlayerCharacter.java +++ b/src/engine/objects/PlayerCharacter.java @@ -5234,6 +5234,12 @@ public class PlayerCharacter extends AbstractCharacter { } } + if(!this.timestamps.containsKey("nextReload")){ + this.timestamps.put("nextReload",System.currentTimeMillis() + 5000L); + }else{ + if(this.timestamps.get("nextReload") > System.currentTimeMillis()) + updateLoadedPlayers(this); + } } catch (Exception e) { Logger.error(e); @@ -5245,23 +5251,6 @@ public class PlayerCharacter extends AbstractCharacter { Logger.error("UPDATE ISSUE: " + e); } } - - public void updateBoxStatus(boolean newValue) { - - this.isBoxed = newValue; // Update the isBoxed status - - if(this.isBoxed) { - if(!this.title.equals(CharacterTitle.PVE)){ - this.title = CharacterTitle.PVE; - this.getClientConnection().forceDisconnect(); - } - }else{ - if(!this.title.equals(CharacterTitle.NONE)){ - this.title = CharacterTitle.NONE; - this.getClientConnection().forceDisconnect(); - } - } - } public static void unboxPlayer(PlayerCharacter player) { String machineID = player.getClientConnection().machineID; ArrayList sameMachine = new ArrayList<>(); @@ -5273,13 +5262,24 @@ public class PlayerCharacter extends AbstractCharacter { for (PlayerCharacter pc : sameMachine) { if(pc.equals(player)) continue; - //pc.isBoxed = true; - //pc.updateBoxStatus(true); pc.isBoxed = true; } - //player.updateBoxStatus(false); player.isBoxed = false; } + + public static void updateLoadedPlayers(PlayerCharacter pc){ + HashSet inRange = WorldGrid.getObjectsInRangePartial(pc.loc,MBServerStatics.CHARACTER_LOAD_RANGE,MBServerStatics.MASK_PLAYER); + for(AbstractWorldObject awo : inRange){ + if(pc.loadedObjects.contains(awo)) + continue; + PlayerCharacter toLoad = (PlayerCharacter)awo; + if(toLoad.hidden > pc.seeInvis) + continue; + LoadCharacterMsg lcm = new LoadCharacterMsg(toLoad, PlayerCharacter.hideNonAscii()); + pc.getClientConnection().sendMsg(lcm); + pc.loadedObjects.add(toLoad); + } + } public static boolean checkIfBoxed(PlayerCharacter player){ if(ConfigManager.MB_WORLD_BOXLIMIT.getValue().equals("false")) { return false;