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(){
|
public static void useTargeting(){
|
||||||
if (lastTarget != null &&
|
if (instance != null &&
|
||||||
|
instance.visible &&
|
||||||
|
lastTarget != null &&
|
||||||
Actor.chars().contains( lastTarget ) &&
|
Actor.chars().contains( lastTarget ) &&
|
||||||
lastTarget.isAlive() &&
|
lastTarget.isAlive() &&
|
||||||
lastTarget.alignment != Char.Alignment.ALLY &&
|
lastTarget.alignment != Char.Alignment.ALLY &&
|
||||||
|
@ -531,6 +533,7 @@ public class InventoryPane extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selector == null){
|
if (selector == null){
|
||||||
|
targetingSlot = this;
|
||||||
RightClickMenu r = new RightClickMenu(item);
|
RightClickMenu r = new RightClickMenu(item);
|
||||||
parent.addToFront(r);
|
parent.addToFront(r);
|
||||||
r.camera = camera();
|
r.camera = camera();
|
||||||
|
|
|
@ -104,6 +104,10 @@ public class RightClickMenu extends Component {
|
||||||
super.onClick();
|
super.onClick();
|
||||||
if (item != null){
|
if (item != null){
|
||||||
item.execute(Dungeon.hero, options[finalI]);
|
item.execute(Dungeon.hero, options[finalI]);
|
||||||
|
|
||||||
|
if (options[finalI].equals(item.defaultAction) && item.usesTargeting){
|
||||||
|
InventoryPane.useTargeting();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onSelect(finalI);
|
onSelect(finalI);
|
||||||
RightClickMenu.this.destroy();
|
RightClickMenu.this.destroy();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user