Added Battery Hardware. #2

This commit is contained in:
simon
2017-11-12 10:27:07 -05:00
parent f7ea14275c
commit a3fa3c4c09
21 changed files with 224 additions and 99 deletions

View File

@@ -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();
}

View File

@@ -444,5 +444,11 @@ public class CPU implements JSONSerialisable{
return str;
}
public CpuHardware getHardware(int address) {
return attachedHardware.get(address);
}
}

View File

@@ -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;
}

View File

@@ -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);
}