mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-15 15:52:34 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user