Added spawner and waypoint components, added building_set_waypoint order, particle emitters can now toggle their emission, buildings can now build and spawn units, buildings now dynamically emit smoke when working and no longer when building, added player2 to default game for testing.

This commit is contained in:
2021-01-01 10:18:16 -06:00
parent 0b3897451e
commit 74458dbfd0
22 changed files with 200 additions and 36 deletions

23
lib/components/spawner.rb Normal file
View File

@@ -0,0 +1,23 @@
class IMICRTS
class Spawner < Component
def tick(tick_id)
# TODO: Ensure that a build order is created before working on entity
item = @parent.component(:build_queue).queue.first
if item
item.progress += 1
if item.progress >= 100 # TODO: Define work units required for construction
@parent.component(:build_queue).queue.shift
spawn_point = @parent.position.clone
spawn_point.y += 96 # TODO: Use one of entity's reserved tiles for spawning
ent = @parent.director.spawn_entity(player_id: @parent.player.id, name: item.entity.name, position: spawn_point)
ent.target = @parent.component(:waypoint).waypoint if @parent.component(:waypoint)
end
end
end
end
end