Added replaced sidebar label buttons with images, added 'radar' (currently static map image)

This commit is contained in:
2021-01-06 10:31:57 -06:00
parent 18641ece15
commit 0d449b9375
12 changed files with 85 additions and 50 deletions

View File

@@ -6,11 +6,13 @@ tiles = [
[false, :path, :path, :path, false],
]
IMICRTS::Entity.define_entity(:barracks, :building, 400, 40, "Builds and soldiers", tiles) do |entity|
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
IMICRTS::Entity.define_entity(:barracks, :building, 400, 40, "Builds and heals soldiers", tiles) do |entity|
unless entity.proto_entity
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
end
entity.radius = 44
entity.max_health = 100.0

View File

@@ -7,12 +7,14 @@ tiles = [
]
IMICRTS::Entity.define_entity(:construction_yard, :building, 2_000, 310, "Provides radar and builds construction workers", tiles) do |entity|
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
entity.has(:sidebar_actions)
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :construction_worker })
unless entity.proto_entity
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
entity.has(:sidebar_actions)
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :construction_worker })
end
entity.radius = 40
entity.max_health = 100.0

View File

@@ -6,13 +6,15 @@ tiles = [
[false, false, false, false, false],
]
IMICRTS::Entity.define_entity(:helipad, :building, 1_000, 100, "Builds and rearms helicopters", tiles) do |entity|
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
entity.has(:sidebar_actions)
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :helicopter })
IMICRTS::Entity.define_entity(:helipad, :building, 1_000, 100, "Builds and rearms aircraft", tiles) do |entity|
unless entity.proto_entity
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
entity.has(:sidebar_actions)
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :helicopter })
end
entity.radius = 26
entity.max_health = 100.0

View File

@@ -7,7 +7,9 @@ tiles = [
]
IMICRTS::Entity.define_entity(:power_plant, :building, 800, 45, "Generates power", tiles) do |entity|
entity.has(:building)
unless entity.proto_entity
entity.has(:building)
end
entity.radius = 24
entity.max_health = 100.0
@@ -29,14 +31,13 @@ IMICRTS::Entity.define_entity(:power_plant, :building, 800, 45, "Generates power
emitters.each do |pos|
entity.particle_emitters << IMICRTS::SmokeEmitter.new(position: pos)
entity.particle_emitters << IMICRTS::SmokeEmitter.new(position: pos, emitting: false)
end
entity.on_tick do
# entity.produce_power
if entity.component(:building).data.state == :idle
if entity.component(:building).construction_complete?
entity.particle_emitters.each do |emitter|
emitter.emitting = true
end

View File

@@ -7,7 +7,9 @@ tiles = [
]
IMICRTS::Entity.define_entity(:refinery, :building, 1_400, 200, "Generates credits", tiles) do |entity|
entity.has(:building)
unless entity.proto_entity
entity.has(:building)
end
entity.radius = 44
entity.max_health = 100.0

View File

@@ -6,15 +6,17 @@ tiles = [
[false, :path, :path, :path, false],
]
IMICRTS::Entity.define_entity(:war_factory, :building, 2_000, 310, "Builds units", tiles) do |entity|
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
entity.has(:sidebar_actions)
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :jeep })
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :tank })
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :harvester })
IMICRTS::Entity.define_entity(:war_factory, :building, 2_000, 310, "Builds and repairs ground vehicles", tiles) do |entity|
unless entity.proto_entity
entity.has(:building)
entity.has(:waypoint)
entity.has(:spawner)
entity.has(:build_queue)
entity.has(:sidebar_actions)
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :jeep })
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :tank })
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :harvester })
end
entity.radius = 48
entity.max_health = 100.0

View File

@@ -1,9 +1,11 @@
IMICRTS::Entity.define_entity(:construction_worker, :unit, 1000, 75, "Constructs buildings") do |entity|
entity.has(:movement)
entity.has(:build_queue)
entity.has(:sidebar_actions)
[:power_plant, :refinery, :barracks, :war_factory, :helipad, :construction_yard].each do |ent|
entity.component(:sidebar_actions).add(:set_tool, { tool: :place_entity, entity: ent, construction_worker: entity })
unless entity.proto_entity
entity.has(:movement)
entity.has(:build_queue)
entity.has(:sidebar_actions)
[:power_plant, :refinery, :barracks, :war_factory, :helipad, :construction_yard].each do |ent|
entity.component(:sidebar_actions).add(:set_tool, { tool: :place_entity, entity: ent, construction_worker: entity })
end
end
entity.radius = 14