From 8a3a4645af76f666810532d5aaa16a526d5a8e5f Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 20 Apr 2024 10:09:13 -0500 Subject: [PATCH] zerg mechanic work --- src/engine/jobs/ActivateBaneJob.java | 7 ++++--- src/engine/objects/Mine.java | 5 +---- src/engine/workthreads/ZergMechanicThread.java | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/engine/jobs/ActivateBaneJob.java b/src/engine/jobs/ActivateBaneJob.java index 99e5f91d..cc458624 100644 --- a/src/engine/jobs/ActivateBaneJob.java +++ b/src/engine/jobs/ActivateBaneJob.java @@ -15,10 +15,13 @@ import engine.gameManager.DbManager; import engine.job.AbstractScheduleJob; import engine.net.DispatchMessage; import engine.net.client.msg.chat.ChatSystemMsg; +import engine.objects.Bane; import engine.objects.City; import engine.workthreads.ZergMechanicThread; import org.pmw.tinylog.Logger; +import static engine.workthreads.ZergMechanicThread.startZergThreadBane; + public class ActivateBaneJob extends AbstractScheduleJob { private final int cityUUID; @@ -70,9 +73,7 @@ public class ActivateBaneJob extends AbstractScheduleJob { DispatchMessage.dispatchMsgToAll(msg); if(city.getBane() != null) { - Thread zergMechanicThread = new Thread(new ZergMechanicThread(city.getBane(), null)); - zergMechanicThread.setName(city.getName() + "Bane"); - zergMechanicThread.start(); + startZergThreadBane(city.getBane()); } } diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 16a981f5..b505afb7 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -581,10 +581,7 @@ public class Mine extends AbstractGameObject { building.isDeranking.compareAndSet(true, false); if(isAc) { - Thread zergMechanicThread; - zergMechanicThread = new Thread(new ZergMechanicThread(null, this)); - zergMechanicThread.setName(this.parentZone.getName() + "Mine"); - zergMechanicThread.start(); + ZergMechanicThread.startZergThreadMine(this); } } diff --git a/src/engine/workthreads/ZergMechanicThread.java b/src/engine/workthreads/ZergMechanicThread.java index cf36db27..e857e9cb 100644 --- a/src/engine/workthreads/ZergMechanicThread.java +++ b/src/engine/workthreads/ZergMechanicThread.java @@ -14,6 +14,7 @@ import engine.InterestManagement.WorldGrid; import engine.db.archive.DataWarehouse; import engine.db.archive.MineRecord; import engine.gameManager.*; +import engine.mobileAI.Threads.MobAIThread; import engine.net.DispatchMessage; import engine.net.MessageDispatcher; import engine.net.client.msg.chat.ChatSystemMsg; @@ -163,4 +164,18 @@ public Mine mine = null; } } } + + public static void startZergThreadMine(Mine mine) { + Thread zergMechanicThread; + zergMechanicThread = new Thread(new ZergMechanicThread(null, mine)); + zergMechanicThread.setName(mine.getParentZone().getName() + "Mine"); + zergMechanicThread.start(); + } + + public static void startZergThreadBane(Bane bane) { + Thread zergMechanicThread; + zergMechanicThread = new Thread(new ZergMechanicThread(bane, null)); + zergMechanicThread.setName(bane.getCity().getGuild().getName() + "Bane"); + zergMechanicThread.start(); + } }