mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-16 08:02:36 +00:00
added on_order handler to entities and components, added visibility map
This commit is contained in:
@@ -1,12 +1,7 @@
|
||||
IMICRTS::Order.define_handler(IMICRTS::Order::BUILD_UNIT_COMPLETE, arguments: [:player_id, :entity_id]) do |order, director|
|
||||
entity = director.player(order.player_id).entity(order.entity_id)
|
||||
item = entity.component(:build_queue).queue.shift
|
||||
|
||||
spawn_point = entity.position.clone
|
||||
spawn_point.y += 96 # TODO: Use entity defined spawnpoint
|
||||
|
||||
ent = entity.director.spawn_entity(player_id: entity.player.id, name: item.entity.name, position: spawn_point)
|
||||
ent.target = entity.component(:waypoint).waypoint if entity.component(:waypoint)
|
||||
entity.handle_order(IMICRTS::Order::BUILD_UNIT_COMPLETE, order)
|
||||
end
|
||||
|
||||
IMICRTS::Order.define_serializer(IMICRTS::Order::BUILD_UNIT_COMPLETE) do |order, director|
|
||||
|
||||
Reference in New Issue
Block a user