mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-12-13 14:49:03 +00:00
Added Battery Hardware. #2
This commit is contained in:
@@ -15,6 +15,7 @@ import org.json.simple.JSONObject;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GameServer implements Runnable {
|
||||
|
||||
@@ -112,7 +113,9 @@ public class GameServer implements Runnable {
|
||||
}
|
||||
|
||||
//Process each worlds
|
||||
for (World world : gameUniverse.getWorlds()) {
|
||||
//Avoid concurrent modification
|
||||
ArrayList<World> worlds = new ArrayList<>(gameUniverse.getWorlds());
|
||||
for (World world : worlds) {
|
||||
world.update();
|
||||
}
|
||||
|
||||
|
||||
@@ -444,5 +444,11 @@ public class CPU implements JSONSerialisable{
|
||||
return str;
|
||||
}
|
||||
|
||||
public CpuHardware getHardware(int address) {
|
||||
|
||||
return attachedHardware.get(address);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -120,9 +120,6 @@ public abstract class GameObject implements JSONSerialisable {
|
||||
x = newX;
|
||||
y = newY;
|
||||
} else {
|
||||
//Display error when object is trying to walk in a wall
|
||||
//TODO Add emote here
|
||||
//System.out.println("DEBUG: FAILED walk");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,12 @@ public interface InventoryHolder {
|
||||
/**
|
||||
* Take an item from the inventory
|
||||
* @param item Desired item id (see MarConstants.ITEM_*)
|
||||
* @return true is the take item action executed properly, true also means that the desired item
|
||||
* was removed from the inventory
|
||||
*/
|
||||
boolean takeItem(int item);
|
||||
void takeItem(int item);
|
||||
|
||||
/**
|
||||
* @param item item to take
|
||||
* @return true if the InventoryHolder can provide this item
|
||||
*/
|
||||
boolean canTakeItem(int item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user