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
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);
}
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
public Action[] getActions() {
return new Action[] {
ACTION_HAUL
};
Action[] actions = new Action[1];
if(haulJob == null) actions[0] = HAUL;
else actions[0] = CANCEL_HAUL;
return actions;
}
@Override
@ -62,15 +64,9 @@ public abstract class Item extends WorldObject implements ISelectable, ITileThin
@Override
public void runAction(Action action) {
if (action == ACTION_HAUL) {
toggleHaul();
}
}
private void toggleHaul() {
if(haulJob == null) {
if (action == HAUL) {
markForHaul();
} else {
} else if (action == CANCEL_HAUL) {
cancelHaul();
}
}