From a76534f0afe5e83de0ecc96a3172352fe7bd2385 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 13 Jan 2023 14:34:04 -0500 Subject: [PATCH] Mesh set properly when errant mine loaded. --- src/engine/objects/Mine.java | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index b9c68ca5..642900ff 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -123,13 +123,11 @@ public class Mine extends AbstractGameObject { nation = Guild.getErrantGuild(); this.owningGuild = Guild.getErrantGuild(); } - - int mineTime = this.owningGuild.getMineTime(); + if(!nation.isErrant()) { this.nationName = nation.getName(); this.nationTag = nation.getGuildTag(); - mineTime = nation.getMineTime(); } else { this.nationName = ""; this.nationTag = GuildTag.ERRANT; @@ -227,11 +225,26 @@ try{ // If errant use mine stays open. - if (this.owningGuild == null || this.owningGuild.isErrant() == true) + if (this.owningGuild == null || this.owningGuild.isErrant() == true) { + + // Update mesh + + Building mineBuilding = BuildingManager.getBuildingFromCache(this.buildingID); + + if (mineBuilding == null){ + Logger.debug( "Null mine building " + this.getObjectUUID() +". Unable to Load Building with UID " +this.buildingID); + return; + } + + mineBuilding.healthMax = (float) 1; + mineBuilding.meshUUID = mineBuilding.getBlueprint().getMeshForRank(-1); + mineBuilding.setRank(-1); + mineBuilding.setCurrentHitPoints((float) 1); return; + } - if (this.owningGuild != null) - nation = this.owningGuild.getNation(); + + nation = this.owningGuild.getNation(); int mineTime = (nation != null && !nation.isErrant()) ? nation.getMineTime() : MBServerStatics.MINE_EARLY_WINDOW;