v1.2.1: fixed autotargeting not working with right click menus
This commit is contained in:
parent
e8d33abb73
commit
1a4378d1b7
|
@ -372,7 +372,9 @@ public class InventoryPane extends Component {
|
|||
}
|
||||
|
||||
public static void useTargeting(){
|
||||
if (lastTarget != null &&
|
||||
if (instance != null &&
|
||||
instance.visible &&
|
||||
lastTarget != null &&
|
||||
Actor.chars().contains( lastTarget ) &&
|
||||
lastTarget.isAlive() &&
|
||||
lastTarget.alignment != Char.Alignment.ALLY &&
|
||||
|
@ -531,6 +533,7 @@ public class InventoryPane extends Component {
|
|||
}
|
||||
|
||||
if (selector == null){
|
||||
targetingSlot = this;
|
||||
RightClickMenu r = new RightClickMenu(item);
|
||||
parent.addToFront(r);
|
||||
r.camera = camera();
|
||||
|
|
|
@ -104,6 +104,10 @@ public class RightClickMenu extends Component {
|
|||
super.onClick();
|
||||
if (item != null){
|
||||
item.execute(Dungeon.hero, options[finalI]);
|
||||
|
||||
if (options[finalI].equals(item.defaultAction) && item.usesTargeting){
|
||||
InventoryPane.useTargeting();
|
||||
}
|
||||
}
|
||||
onSelect(finalI);
|
||||
RightClickMenu.this.destroy();
|
||||
|
|
Loading…
Reference in New Issue
Block a user