From 4b7ebd7ad6d18b807c9b345d3b97e08d765623eb Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 7 Jun 2018 21:40:59 +0200 Subject: [PATCH 1/3] Added radioactive obstacle. --- .../net/simon987/npcplugin/NpcPlugin.java | 1 + .../npcplugin/RadioactiveObstacle.java | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java diff --git a/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java b/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java index b2e3369..e555b55 100644 --- a/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java +++ b/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java @@ -34,6 +34,7 @@ public class NpcPlugin extends ServerPlugin { registry.registerGameObject(ElectricBox.class); registry.registerGameObject(Portal.class); registry.registerGameObject(VaultExitPortal.class); + registry.registerGameObject(RadioactiveObstacle.class); registry.registerHardware(RadioReceiverHardware.class); diff --git a/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java b/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java new file mode 100644 index 0000000..705bc9e --- /dev/null +++ b/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java @@ -0,0 +1,46 @@ +package net.simon987.npcplugin; + +import org.bson.Document; + +import net.simon987.server.game.objects.ControllableUnit; +import net.simon987.server.game.objects.Enterable; +import net.simon987.server.game.objects.GameObject; +import net.simon987.server.game.objects.Radioactive; + +public class RadioactiveObstacle extends GameObject implements Radioactive, Enterable { + + private int corruptionBlockSize; + + public RadioactiveObstacle(int corruptionBlockSize) { + this.corruptionBlockSize = corruptionBlockSize; + } + + @Override + public char getMapInfo() { + // TODO I don't know how this should be done. + return 0; + } + + @Override + public boolean enter(GameObject object) { + if (object instanceof ControllableUnit) + ((ControllableUnit) object).getCpu().getMemory().corrupt(corruptionBlockSize); + return false; + } + + public Document mongoSerialize() { + Document dbObject = super.mongoSerialise(); + + dbObject.put("corruptionBlockSize", corruptionBlockSize); + + return dbObject; + } + + public void setBlockSize(int corruptionBlockSize) { + this.corruptionBlockSize = corruptionBlockSize; + } + + public int getBlockSize() { + return corruptionBlockSize; + } +} From e8543082ce34087d81b5418f26283435402daaa8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 7 Jun 2018 23:24:49 +0200 Subject: [PATCH 2/3] Fixed radioactive obstacle. Added "radioactive obstacle curruption block size" in config.properties and removed its getter and setter. --- .../npcplugin/RadioactiveObstacle.java | 71 +++++++------------ Server/src/main/resources/config.properties | 4 +- 2 files changed, 28 insertions(+), 47 deletions(-) diff --git a/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java b/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java index 705bc9e..b32298a 100644 --- a/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java +++ b/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java @@ -1,46 +1,25 @@ -package net.simon987.npcplugin; - -import org.bson.Document; - -import net.simon987.server.game.objects.ControllableUnit; -import net.simon987.server.game.objects.Enterable; -import net.simon987.server.game.objects.GameObject; -import net.simon987.server.game.objects.Radioactive; - -public class RadioactiveObstacle extends GameObject implements Radioactive, Enterable { - - private int corruptionBlockSize; - - public RadioactiveObstacle(int corruptionBlockSize) { - this.corruptionBlockSize = corruptionBlockSize; - } - - @Override - public char getMapInfo() { - // TODO I don't know how this should be done. - return 0; - } - - @Override - public boolean enter(GameObject object) { - if (object instanceof ControllableUnit) - ((ControllableUnit) object).getCpu().getMemory().corrupt(corruptionBlockSize); - return false; - } - - public Document mongoSerialize() { - Document dbObject = super.mongoSerialise(); - - dbObject.put("corruptionBlockSize", corruptionBlockSize); - - return dbObject; - } - - public void setBlockSize(int corruptionBlockSize) { - this.corruptionBlockSize = corruptionBlockSize; - } - - public int getBlockSize() { - return corruptionBlockSize; - } -} +package net.simon987.npcplugin; + +import net.simon987.server.GameServer; +import net.simon987.server.game.objects.ControllableUnit; +import net.simon987.server.game.objects.Enterable; +import net.simon987.server.game.objects.GameObject; +import net.simon987.server.game.objects.Radioactive; + +public class RadioactiveObstacle extends GameObject implements Radioactive, Enterable { + + private final static int corruptionBlockSize = GameServer.INSTANCE.getConfig().getInt("radioactive_obstacle_corruption_block_size"); + + @Override + public char getMapInfo() { + return 0; + } + + @Override + public boolean enter(GameObject object) { + if (object instanceof ControllableUnit) { + ((ControllableUnit) object).getCpu().getMemory().corrupt(corruptionBlockSize); + } + return false; + } +} \ No newline at end of file diff --git a/Server/src/main/resources/config.properties b/Server/src/main/resources/config.properties index e6a33a2..95811d8 100644 --- a/Server/src/main/resources/config.properties +++ b/Server/src/main/resources/config.properties @@ -81,4 +81,6 @@ vault_wg_max_electric_box_count=4 electric_box_hp=250 electric_box_respawnTime=256 electric_box_damage=5 -electric_box_energy_given=70 \ No newline at end of file +electric_box_energy_given=70 +#RadioactiveObstacle +radioactive_obstacle_corruption_block_size=10 \ No newline at end of file From a73aa7c3a5108ef175adb67a6602237623c3f5f4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 8 Jun 2018 09:58:52 +0200 Subject: [PATCH 3/3] Moved radioactive obstacle. --- .../net/simon987/npcplugin/NpcPlugin.java | 1 - .../RadioactiveObstacle.java | 48 +++++++++---------- 2 files changed, 24 insertions(+), 25 deletions(-) rename {Plugin NPC/src/main/java/net/simon987/npcplugin => Plugin Radioactive Cloud/src/main/java/net/simon987/pluginradioactivecloud}/RadioactiveObstacle.java (92%) diff --git a/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java b/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java index e555b55..b2e3369 100644 --- a/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java +++ b/Plugin NPC/src/main/java/net/simon987/npcplugin/NpcPlugin.java @@ -34,7 +34,6 @@ public class NpcPlugin extends ServerPlugin { registry.registerGameObject(ElectricBox.class); registry.registerGameObject(Portal.class); registry.registerGameObject(VaultExitPortal.class); - registry.registerGameObject(RadioactiveObstacle.class); registry.registerHardware(RadioReceiverHardware.class); diff --git a/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java b/Plugin Radioactive Cloud/src/main/java/net/simon987/pluginradioactivecloud/RadioactiveObstacle.java similarity index 92% rename from Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java rename to Plugin Radioactive Cloud/src/main/java/net/simon987/pluginradioactivecloud/RadioactiveObstacle.java index b32298a..ade7e3e 100644 --- a/Plugin NPC/src/main/java/net/simon987/npcplugin/RadioactiveObstacle.java +++ b/Plugin Radioactive Cloud/src/main/java/net/simon987/pluginradioactivecloud/RadioactiveObstacle.java @@ -1,25 +1,25 @@ -package net.simon987.npcplugin; - -import net.simon987.server.GameServer; -import net.simon987.server.game.objects.ControllableUnit; -import net.simon987.server.game.objects.Enterable; -import net.simon987.server.game.objects.GameObject; -import net.simon987.server.game.objects.Radioactive; - -public class RadioactiveObstacle extends GameObject implements Radioactive, Enterable { - - private final static int corruptionBlockSize = GameServer.INSTANCE.getConfig().getInt("radioactive_obstacle_corruption_block_size"); - - @Override - public char getMapInfo() { - return 0; - } - - @Override - public boolean enter(GameObject object) { - if (object instanceof ControllableUnit) { - ((ControllableUnit) object).getCpu().getMemory().corrupt(corruptionBlockSize); - } - return false; - } +package net.simon987.pluginradioactivecloud; + +import net.simon987.server.GameServer; +import net.simon987.server.game.objects.ControllableUnit; +import net.simon987.server.game.objects.Enterable; +import net.simon987.server.game.objects.GameObject; +import net.simon987.server.game.objects.Radioactive; + +public class RadioactiveObstacle extends GameObject implements Radioactive, Enterable { + + private final static int corruptionBlockSize = GameServer.INSTANCE.getConfig().getInt("radioactive_obstacle_corruption_block_size"); + + @Override + public char getMapInfo() { + return 0; + } + + @Override + public boolean enter(GameObject object) { + if (object instanceof ControllableUnit) { + ((ControllableUnit) object).getCpu().getMemory().corrupt(corruptionBlockSize); + } + return false; + } } \ No newline at end of file