Added basic Radio Tower functionality #32

Keypress buffer is cleared on code upload
This commit is contained in:
simon
2017-12-29 21:49:42 -05:00
parent 5afa767b4a
commit ef7f573256
15 changed files with 391 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ public enum Action {
DIGGING,
WALKING,
WITHDRAWING,
DEPOSITING
DEPOSITING,
LISTENING
}

View File

@@ -21,4 +21,9 @@ public interface ControllableUnit {
int getEnergy();
int getX();
int getY();
void setAction(Action listening);
}

View File

@@ -0,0 +1,7 @@
package net.simon987.server.game;
public interface Programmable {
void sendMessage(char[] message);
}

View File

@@ -33,6 +33,13 @@ public class CodeUploadHandler implements MessageHandler {
user.getUser().getCpu().getMemory().write((char) ar.origin, assembledCode, 0, assembledCode.length);
user.getUser().getCpu().setCodeSegmentOffset(ar.getCodeSegmentOffset());
//Clear keyboard buffer
if (user.getUser().getControlledUnit() != null &&
user.getUser().getControlledUnit().getKeyboardBuffer() != null) {
user.getUser().getControlledUnit().getKeyboardBuffer().clear();
}
JSONObject response = new JSONObject();
response.put("t", "codeResponse");
response.put("bytes", ar.bytes.length);