mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-13 06:52:33 +00:00
clear sidebar actions when deselecting entities and replace with newly selected entity's actions, if any.
This commit is contained in:
@@ -57,20 +57,22 @@ class IMICRTS
|
|||||||
@selection_start = nil
|
@selection_start = nil
|
||||||
|
|
||||||
diff = (@player.selected_entities - @game.selected_entities)
|
diff = (@player.selected_entities - @game.selected_entities)
|
||||||
|
@game.sidebar_actions.clear
|
||||||
|
|
||||||
@director.schedule_order(Order::DESELECTED_UNITS, @player.id, diff) if diff.size > 0
|
@director.schedule_order(Order::DESELECTED_UNITS, @player.id, diff) if diff.size > 0
|
||||||
if @game.selected_entities.size > 0
|
if @game.selected_entities.size > 0
|
||||||
@director.schedule_order(Order::SELECTED_UNITS, @player.id, @game.selected_entities)
|
@director.schedule_order(Order::SELECTED_UNITS, @player.id, @game.selected_entities)
|
||||||
else
|
else
|
||||||
pick_entity
|
pick_entity
|
||||||
if ent = @game.selected_entities.first
|
end
|
||||||
return unless ent.component(:sidebar_actions)
|
|
||||||
|
|
||||||
@game.sidebar_actions.clear do |stack|
|
if @game.selected_entities.size < 2 && ent = @game.selected_entities.first
|
||||||
ent.component(:sidebar_actions).actions.each do |action|
|
return unless ent.component(:sidebar_actions)
|
||||||
stack.button action.label, tip: action.description, width: 1.0 do
|
|
||||||
action.block.call if action.block
|
@game.sidebar_actions.clear do |stack|
|
||||||
end
|
ent.component(:sidebar_actions).actions.each do |action|
|
||||||
|
stack.button action.label, tip: action.description, width: 1.0 do
|
||||||
|
action.block.call if action.block
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user