better haul designations
parent
1c926a8af4
commit
53cb3b04fb
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue