Fixed radioactive obstacle.

Added "radioactive obstacle curruption block size" in config.properties and removed its getter and setter.
This commit is contained in:
Unknown 2018-06-07 23:24:49 +02:00
parent 4b7ebd7ad6
commit e8543082ce
2 changed files with 28 additions and 47 deletions

View File

@ -1,46 +1,25 @@
package net.simon987.npcplugin; package net.simon987.npcplugin;
import org.bson.Document; import net.simon987.server.GameServer;
import net.simon987.server.game.objects.ControllableUnit;
import net.simon987.server.game.objects.ControllableUnit; import net.simon987.server.game.objects.Enterable;
import net.simon987.server.game.objects.Enterable; import net.simon987.server.game.objects.GameObject;
import net.simon987.server.game.objects.GameObject; import net.simon987.server.game.objects.Radioactive;
import net.simon987.server.game.objects.Radioactive;
public class RadioactiveObstacle extends GameObject implements Radioactive, Enterable {
public class RadioactiveObstacle extends GameObject implements Radioactive, Enterable {
private final static int corruptionBlockSize = GameServer.INSTANCE.getConfig().getInt("radioactive_obstacle_corruption_block_size");
private int corruptionBlockSize;
@Override
public RadioactiveObstacle(int corruptionBlockSize) { public char getMapInfo() {
this.corruptionBlockSize = corruptionBlockSize; return 0;
} }
@Override @Override
public char getMapInfo() { public boolean enter(GameObject object) {
// TODO I don't know how this should be done. if (object instanceof ControllableUnit) {
return 0; ((ControllableUnit) object).getCpu().getMemory().corrupt(corruptionBlockSize);
} }
return false;
@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;
}
}

View File

@ -81,4 +81,6 @@ vault_wg_max_electric_box_count=4
electric_box_hp=250 electric_box_hp=250
electric_box_respawnTime=256 electric_box_respawnTime=256
electric_box_damage=5 electric_box_damage=5
electric_box_energy_given=70 electric_box_energy_given=70
#RadioactiveObstacle
radioactive_obstacle_corruption_block_size=10