better haul designations

pull/1/head
Ivory 2023-01-03 00:20:15 -05:00
parent 1c926a8af4
commit 53cb3b04fb
2 changed files with 9 additions and 13 deletions

View File

@ -12,6 +12,6 @@ public class HaulItemDesignation extends Designation<Item> {
@Override @Override
protected void designate(Item thing) { protected void designate(Item thing) {
thing.runAction(Item.ACTION_HAUL); thing.runAction(Item.HAUL);
} }
} }

View File

@ -42,13 +42,15 @@ public abstract class Item extends WorldObject implements ISelectable, ITileThin
return new Vector4f(x, y, x + 1, y + 1); return new Vector4f(x, y, x + 1, y + 1);
} }
public static final Action ACTION_HAUL = new Action("Haul"); public static final Action HAUL = new Action("Haul");
public static final Action CANCEL_HAUL = new Action("Cancel\n Haul");
@Override @Override
public Action[] getActions() { public Action[] getActions() {
return new Action[] { Action[] actions = new Action[1];
ACTION_HAUL if(haulJob == null) actions[0] = HAUL;
}; else actions[0] = CANCEL_HAUL;
return actions;
} }
@Override @Override
@ -62,15 +64,9 @@ public abstract class Item extends WorldObject implements ISelectable, ITileThin
@Override @Override
public void runAction(Action action) { public void runAction(Action action) {
if (action == ACTION_HAUL) { if (action == HAUL) {
toggleHaul();
}
}
private void toggleHaul() {
if(haulJob == null) {
markForHaul(); markForHaul();
} else { } else if (action == CANCEL_HAUL) {
cancelHaul(); cancelHaul();
} }
} }