mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-24 13:05:51 +00:00
Added radioactive obstacle.
This commit is contained in:
parent
b6a206f3c7
commit
4b7ebd7ad6
@ -34,6 +34,7 @@ public class NpcPlugin extends ServerPlugin {
|
|||||||
registry.registerGameObject(ElectricBox.class);
|
registry.registerGameObject(ElectricBox.class);
|
||||||
registry.registerGameObject(Portal.class);
|
registry.registerGameObject(Portal.class);
|
||||||
registry.registerGameObject(VaultExitPortal.class);
|
registry.registerGameObject(VaultExitPortal.class);
|
||||||
|
registry.registerGameObject(RadioactiveObstacle.class);
|
||||||
|
|
||||||
registry.registerHardware(RadioReceiverHardware.class);
|
registry.registerHardware(RadioReceiverHardware.class);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user