now save player name from SoloLobby, made Director know able game so that construction workers can set active tool for Game (todo: implement tools :D), drafted 'structure' document

This commit is contained in:
2019-11-22 17:18:44 -06:00
parent 8b6f629a6a
commit 2b1ff35a34
8 changed files with 56 additions and 19 deletions

View File

@@ -9,19 +9,31 @@ class IMICRTS
@actions = []
end
def add(action, *args)
case action
def add(type, *args)
action = Action.new
case type
when :add_to_build_queue
action = Action.new
ent = IMICRTS::Entity.get(args.first)
raise "Failed to find entity: #{args.first.inspect}" unless ent
action.label = ent.name.to_s.split("_").map{ |s| s.capitalize }.join(" ")
action.description = "Cost: #{ent.cost}\n#{ent.description}"
action.block = proc { @parent.component(:build_queue).add(args.first) }
@actions << action
when :set_build_tool
ent = IMICRTS::Entity.get(args[1])
raise "Failed to find entity: #{args[1].inspect}" unless ent
action.label = ent.name.to_s.split("_").map { |s| s.capitalize }.join(" ")
action.description = "Cost: #{ent.cost}\n#{ent.description}"
action.block = proc { @parent.director.game.set_tool(:building, ent) }
else
raise "Unhandled sidebar action: #{action.inspect}"
end
@actions << action
end
end
end
end