mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-19 18:46:43 +00:00
Small adjustments for laser hw, Improved OffsetOverFlow handling, Increased maximum guest count
This commit is contained in:
parent
c3a0d1bd4d
commit
ee60216784
@ -4,9 +4,9 @@ import net.simon987.server.GameServer;
|
|||||||
import net.simon987.server.assembly.CpuHardware;
|
import net.simon987.server.assembly.CpuHardware;
|
||||||
import net.simon987.server.assembly.Status;
|
import net.simon987.server.assembly.Status;
|
||||||
import net.simon987.server.game.Action;
|
import net.simon987.server.game.Action;
|
||||||
|
import net.simon987.server.game.Attackable;
|
||||||
import net.simon987.server.game.GameObject;
|
import net.simon987.server.game.GameObject;
|
||||||
import net.simon987.server.game.InventoryHolder;
|
import net.simon987.server.game.InventoryHolder;
|
||||||
import net.simon987.server.game.Attackable;
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -27,7 +27,7 @@ public class CubotLaser extends CpuHardware {
|
|||||||
private static final int LASER_DEPOSIT = 2;
|
private static final int LASER_DEPOSIT = 2;
|
||||||
private static final int LASER_ATTACK = 3;
|
private static final int LASER_ATTACK = 3;
|
||||||
|
|
||||||
private static final int LASER_DAMAGE = 20;
|
private static final int LASER_DAMAGE = 25;
|
||||||
|
|
||||||
public CubotLaser(Cubot cubot) {
|
public CubotLaser(Cubot cubot) {
|
||||||
this.cubot = cubot;
|
this.cubot = cubot;
|
||||||
@ -72,7 +72,7 @@ public class CubotLaser extends CpuHardware {
|
|||||||
// TODO
|
// TODO
|
||||||
} else if (a == LASER_ATTACK) {
|
} else if (a == LASER_ATTACK) {
|
||||||
|
|
||||||
if (cubot.spendEnergy(20)) {
|
if (cubot.spendEnergy(70)) {
|
||||||
|
|
||||||
//Get object directly in front of the Cubot
|
//Get object directly in front of the Cubot
|
||||||
Point frontTile = cubot.getFrontTile();
|
Point frontTile = cubot.getFrontTile();
|
||||||
|
@ -8,8 +8,8 @@ public class HarvesterNPC extends NonPlayerCharacter {
|
|||||||
|
|
||||||
public static final int ID = 10;
|
public static final int ID = 10;
|
||||||
|
|
||||||
public static final int MAX_HEALTH = 100;
|
public static final int MAX_HEALTH = GameServer.INSTANCE.getConfig().getInt("harvester_hp_max");
|
||||||
public static final int HEAL_RATE = 5;
|
public static final int HEAL_RATE = GameServer.INSTANCE.getConfig().getInt("harvester_regen");
|
||||||
|
|
||||||
|
|
||||||
public HarvesterNPC() {
|
public HarvesterNPC() {
|
||||||
|
@ -2,11 +2,7 @@ package net.simon987.npcplugin;
|
|||||||
|
|
||||||
import net.simon987.server.GameServer;
|
import net.simon987.server.GameServer;
|
||||||
import net.simon987.server.assembly.Util;
|
import net.simon987.server.assembly.Util;
|
||||||
import net.simon987.server.game.Action;
|
import net.simon987.server.game.*;
|
||||||
import net.simon987.server.game.Direction;
|
|
||||||
import net.simon987.server.game.GameObject;
|
|
||||||
import net.simon987.server.game.Updatable;
|
|
||||||
import net.simon987.server.game.Attackable;
|
|
||||||
import net.simon987.server.game.pathfinding.Node;
|
import net.simon987.server.game.pathfinding.Node;
|
||||||
import net.simon987.server.game.pathfinding.Pathfinder;
|
import net.simon987.server.game.pathfinding.Pathfinder;
|
||||||
import net.simon987.server.logging.LogManager;
|
import net.simon987.server.logging.LogManager;
|
||||||
@ -23,7 +19,7 @@ public abstract class NonPlayerCharacter extends GameObject implements Updatable
|
|||||||
|
|
||||||
// Set these just in case they aren't overridden in the subclass
|
// Set these just in case they aren't overridden in the subclass
|
||||||
public static final int HP_MAX_DEFAULT = 100;
|
public static final int HP_MAX_DEFAULT = 100;
|
||||||
public static final int HP_REGEN_RATE_DEFAULT = 5;
|
public static final int HP_REGEN_RATE_DEFAULT = 0;
|
||||||
|
|
||||||
//Unused
|
//Unused
|
||||||
int energy;
|
int energy;
|
||||||
|
@ -359,9 +359,12 @@ public class Assembler {
|
|||||||
if (currentOffset >= MEM_SIZE) {
|
if (currentOffset >= MEM_SIZE) {
|
||||||
throw new OffsetOverflowException(currentOffset, MEM_SIZE, currentLine);
|
throw new OffsetOverflowException(currentOffset, MEM_SIZE, currentLine);
|
||||||
}
|
}
|
||||||
} catch (AssemblyException e) {
|
} catch (FatalAssemblyException e) {
|
||||||
|
//Don't bother parsing the rest of the code, since it will not be assembled anyway
|
||||||
|
break;
|
||||||
|
} catch (AssemblyException e1) {
|
||||||
//Ignore error on pass 2
|
//Ignore error on pass 2
|
||||||
//System.out.println(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,7 +413,26 @@ public class Assembler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result.bytes = out.toByteArray();
|
//If the code contains OffsetOverFlowException(s), don't bother writing the assembled bytes to memory
|
||||||
|
boolean writeToMemory = true;
|
||||||
|
for (Exception e : result.exceptions) {
|
||||||
|
if (e instanceof OffsetOverflowException) {
|
||||||
|
writeToMemory = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (writeToMemory) {
|
||||||
|
result.bytes = out.toByteArray();
|
||||||
|
} else {
|
||||||
|
result.bytes = new byte[0];
|
||||||
|
LogManager.LOGGER.fine("Skipping writing assembled bytes to memory. (OffsetOverflowException)");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
out.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
LogManager.LOGGER.info("Assembled " + result.bytes.length + " bytes (" + result.exceptions.size() + " errors)");
|
LogManager.LOGGER.info("Assembled " + result.bytes.length + " bytes (" + result.exceptions.size() + " errors)");
|
||||||
for (AssemblyException e : result.exceptions) {
|
for (AssemblyException e : result.exceptions) {
|
||||||
|
@ -248,7 +248,7 @@ public class GameUniverse implements JSONSerialisable {
|
|||||||
public String getGuestUsername() {
|
public String getGuestUsername() {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
while (i < 1000) { //todo get Max guest user cap from config
|
while (i < 10000) { //todo get Max guest user cap from config
|
||||||
if (getUser("guest" + String.valueOf(i)) != null) {
|
if (getUser("guest" + String.valueOf(i)) != null) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -56,6 +56,10 @@ npc_lifetime=1024
|
|||||||
npc_max_factory_distance=3
|
npc_max_factory_distance=3
|
||||||
# Maximum NPC per Factory
|
# Maximum NPC per Factory
|
||||||
factory_max_npc_count=16
|
factory_max_npc_count=16
|
||||||
|
# Harvester max hp
|
||||||
|
harvester_hp_max=100
|
||||||
|
# Harvester hp regeneration per tick
|
||||||
|
harvester_regen=5
|
||||||
# ----------------------------------------------
|
# ----------------------------------------------
|
||||||
# Minimum center point count for the WorldGenerator
|
# Minimum center point count for the WorldGenerator
|
||||||
wg_centerPointCountMin=5
|
wg_centerPointCountMin=5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user