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