Improved place buildings tool to use the grid

This commit is contained in:
2019-11-28 08:17:19 -06:00
parent 8869ddb3de
commit e3d1a84efa
9 changed files with 95 additions and 21 deletions

View File

@@ -1,17 +1,17 @@
class IMICRTS
class Entity
Stub = Struct.new(:name, :type, :cost, :description, :setup)
Stub = Struct.new(:name, :type, :cost, :description, :tiles, :setup)
@entities = {}
def self.get(name)
@entities.dig(name)
end
def self.define_entity(name, type, cost, description, &block)
def self.define_entity(name, type, cost, description, tiles = [[]], &block)
if entity = get(name)
raise "#{name.inspect} is already defined!"
else
@entities[name] = Stub.new(name, type, cost, description, block)
@entities[name] = Stub.new(name, type, cost, description, tiles, block)
end
end