mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-10 14:26:45 +00:00
Merge mischw plugin with cubot package
This commit is contained in:
parent
cc5627902e
commit
ba78d2fd93
@ -1,4 +1,4 @@
|
||||
package net.simon987.mar.mischwplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.mar.server.GameServer;
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
@ -1,4 +1,4 @@
|
||||
package net.simon987.mar.mischwplugin;
|
||||
package net.simon987.mar.cubot;
|
||||
|
||||
import net.simon987.mar.server.assembly.HardwareModule;
|
||||
import net.simon987.mar.server.assembly.Status;
|
@ -44,6 +44,11 @@ public class CpuInitialisationListener implements GameEventListener {
|
||||
CubotShield shieldHw = new CubotShield(cubot);
|
||||
shieldHw.setCpu(cpu);
|
||||
|
||||
Clock clockHw = new Clock();
|
||||
clockHw.setCpu(cpu);
|
||||
RandomNumberGenerator rngHw = new RandomNumberGenerator();
|
||||
rngHw.setCpu(cpu);
|
||||
|
||||
cubot.attachHardware(legHw, CubotLeg.DEFAULT_ADDRESS);
|
||||
cubot.attachHardware(laserHw, CubotLaser.DEFAULT_ADDRESS);
|
||||
cubot.attachHardware(radarHw, CubotLidar.DEFAULT_ADDRESS);
|
||||
@ -57,5 +62,8 @@ public class CpuInitialisationListener implements GameEventListener {
|
||||
cubot.attachHardware(comPortHw, CubotComPort.DEFAULT_ADDRESS);
|
||||
cubot.attachHardware(coreHw, CubotCore.DEFAULT_ADDRESS);
|
||||
cubot.attachHardware(shieldHw, CubotShield.DEFAULT_ADDRESS);
|
||||
|
||||
cubot.attachHardware(clockHw, Clock.DEFAULT_ADDRESS);
|
||||
cubot.attachHardware(rngHw, RandomNumberGenerator.DEFAULT_ADDRESS);
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
package net.simon987.mar.mischwplugin.event;
|
||||
|
||||
import net.simon987.mar.mischwplugin.Clock;
|
||||
import net.simon987.mar.mischwplugin.RandomNumberGenerator;
|
||||
import net.simon987.mar.server.assembly.CPU;
|
||||
import net.simon987.mar.server.event.CpuInitialisationEvent;
|
||||
import net.simon987.mar.server.event.GameEvent;
|
||||
import net.simon987.mar.server.event.GameEventListener;
|
||||
import net.simon987.mar.server.game.objects.HardwareHost;
|
||||
|
||||
public class CpuInitialisationListener implements GameEventListener {
|
||||
|
||||
@Override
|
||||
public Class getListenedEventType() {
|
||||
return CpuInitialisationEvent.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(GameEvent event) {
|
||||
|
||||
CPU cpu = (CPU) event.getSource();
|
||||
HardwareHost cubot = ((CpuInitialisationEvent) event).getUnit();
|
||||
cpu.setHardwareHost(cubot);
|
||||
|
||||
RandomNumberGenerator rngHW = new RandomNumberGenerator();
|
||||
rngHW.setCpu(cpu);
|
||||
Clock clock = new Clock();
|
||||
clock.setCpu(cpu);
|
||||
|
||||
cpu.getHardwareHost().attachHardware(rngHW, RandomNumberGenerator.DEFAULT_ADDRESS);
|
||||
cpu.getHardwareHost().attachHardware(clock, Clock.DEFAULT_ADDRESS);
|
||||
}
|
||||
}
|
@ -13,8 +13,8 @@ import net.simon987.mar.construction.ItemBluePrint;
|
||||
import net.simon987.mar.construction.Obstacle;
|
||||
import net.simon987.mar.cubot.*;
|
||||
import net.simon987.mar.cubot.event.*;
|
||||
import net.simon987.mar.mischwplugin.Clock;
|
||||
import net.simon987.mar.mischwplugin.RandomNumberGenerator;
|
||||
import net.simon987.mar.cubot.Clock;
|
||||
import net.simon987.mar.cubot.RandomNumberGenerator;
|
||||
import net.simon987.mar.npc.*;
|
||||
import net.simon987.mar.npc.event.BeforeSaveListener;
|
||||
import net.simon987.mar.npc.event.LoadListener;
|
||||
|
Loading…
x
Reference in New Issue
Block a user