clear sidebar actions when deselecting entities and replace with newly selected entity's actions, if any.

This commit is contained in:
2019-11-29 15:03:17 -06:00
parent 788ea9ca13
commit ba40645e23

View File

@@ -57,13 +57,16 @@ class IMICRTS
@selection_start = nil
diff = (@player.selected_entities - @game.selected_entities)
@game.sidebar_actions.clear
@director.schedule_order(Order::DESELECTED_UNITS, @player.id, diff) if diff.size > 0
if @game.selected_entities.size > 0
@director.schedule_order(Order::SELECTED_UNITS, @player.id, @game.selected_entities)
else
pick_entity
if ent = @game.selected_entities.first
end
if @game.selected_entities.size < 2 && ent = @game.selected_entities.first
return unless ent.component(:sidebar_actions)
@game.sidebar_actions.clear do |stack|
@@ -76,7 +79,6 @@ class IMICRTS
end
end
end
end
def pick_entity
transform = @player.camera.transform(@game.window.mouse)