mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-15 15:52:34 +00:00
added on_order handler to entities and components, added visibility map
This commit is contained in:
@@ -13,6 +13,8 @@ IMICRTS::Entity.define_entity(:helipad, :structure, 1_000, 100, "Builds and rear
|
||||
entity.has(:spawner)
|
||||
entity.has(:build_queue)
|
||||
entity.has(:sidebar_actions)
|
||||
|
||||
entity.component(:spawner).spawnpoint = entity.position.clone
|
||||
entity.component(:sidebar_actions).add(:add_to_build_queue, { entity: :helicopter })
|
||||
end
|
||||
|
||||
|
||||
@@ -35,4 +35,15 @@ IMICRTS::Entity.define_entity(:refinery, :structure, 1_400, 200, "Generates cred
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
entity.on_order do |type, order|
|
||||
case type
|
||||
when IMICRTS::Order::CONSTRUCTION_COMPLETE
|
||||
pos = entity.position.clone
|
||||
pos.x += 32
|
||||
pos.y += 64
|
||||
|
||||
entity.director.spawn_entity(player_id: entity.player.id, name: :harvester, position: pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ IMICRTS::Entity.define_entity(:helicopter, :unit, 400, 40, "Attacks ground targe
|
||||
entity.radius = 14
|
||||
entity.movement = :air
|
||||
entity.max_health = 100.0
|
||||
entity.position.z = IMICRTS::ZOrder::AIR_VEHICLE
|
||||
|
||||
entity.body_image = "vehicles/helicopter/helicopter.png"
|
||||
entity.shell_image = "vehicles/helicopter/helicopter_shell.png"
|
||||
|
||||
Reference in New Issue
Block a user