Implemented event system, Implemented initial bit of scripting system, Stubbed component system. Entities can now use the scripting system to place their 'decorations'

This commit is contained in:
2019-09-26 12:13:08 -05:00
parent e41a2b6524
commit b6d7a6ebdb
24 changed files with 293 additions and 80 deletions

View File

@@ -1,9 +1,10 @@
context Vehicle # Generic, Weapon
component(:vehicle) # Generic, Weapon
on.button_down(:interact) do |event|
if event.player.touching?(event.entity)
event.player.enter_vehicle
elsif event.player.driving?(event.entity) or event.player.passenger?(event.entity)
event.player.exit_vehicle
end
$window.console.stdin("#{event.entity.name} handled button_down(:interact)")
# if event.player.touching?(event.entity)
# event.player.enter_vehicle
# elsif event.player.driving?(event.entity) or event.player.passenger?(event.entity)
# event.player.exit_vehicle
# end
end

View File

@@ -1,8 +1,8 @@
context Building
component(:building)
on.create do |event|
map.add_entity("base", "purchase_terminal", Vector.new(0, 1.5, 0), Vector.new(0, 90, 0), data: {team: event.entity.team})
map.add_entity("base", "information_panel", Vector.new(2, 1.5, 0), Vector.new(0, 0, 0))
map.add_entity("base", "door", Vector.new(2, 0, 6), Vector.new(0, 0, 0))
map.add_entity("base", "door", Vector.new(2, 0, 6), Vector.new(0, 180, 0))
event.map.insert_entity("base", "purchase_terminal", event.entity.position + Vector.new(1.5, 1.5, 4.52), Vector.new(0, 200, 0), data: {team: nil})
event.map.insert_entity("base", "information_panel", event.entity.position + Vector.new(-3, 0, -1), Vector.new(0, 90, 0))
event.map.insert_entity("base", "door", event.entity.position + Vector.new(0, 0, -6), Vector.new(0, 0, 0))
event.map.insert_entity("base", "door", event.entity.position + Vector.new(0, 0, -6), Vector.new(0, 180, 0))
end

View File

@@ -1,2 +1,5 @@
name: "war_factory"
model: "war_factory.obj"
model: "war_factory.obj"
scripts: [
"war_factory"
]

View File

@@ -0,0 +1,8 @@
component(:building)
on.create do |event|
event.map.insert_entity("base", "purchase_terminal", event.entity.position + Vector.new(6, 1.5, 3), Vector.new(0, -90, 0), data: {team: nil})
event.map.insert_entity("base", "information_panel", event.entity.position + Vector.new(0.5, 0, 3), Vector.new(0, 90, 0))
event.map.insert_entity("base", "door", event.entity.position + Vector.new(3.3, 0, 6), Vector.new(0, 0, 0))
event.map.insert_entity("base", "door", event.entity.position + Vector.new(3.3, 0, 6), Vector.new(0, 180, 0))
end