diff --git a/assets/level/Level.glb b/assets/level/Level.glb index 2e29c75..7ec4a22 100644 Binary files a/assets/level/Level.glb and b/assets/level/Level.glb differ diff --git a/scenes/comm_station.tscn b/scenes/comm_station.tscn index 5ffd7e6..41a3880 100644 --- a/scenes/comm_station.tscn +++ b/scenes/comm_station.tscn @@ -1,36 +1,18 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://scenes/item_dump.tscn" type="PackedScene" id=1] [ext_resource path="res://scripts/comm_station/comm_station.gd" type="Script" id=2] [ext_resource path="res://scenes/coin_machine.tscn" type="PackedScene" id=3] [ext_resource path="res://item_types/ore.tres" type="Resource" id=4] [ext_resource path="res://item_types/repair_kit.tres" type="Resource" id=5] - -[sub_resource type="PrismMesh" id=2] - -[sub_resource type="CylinderShape" id=3] +[ext_resource path="res://scenes/status_light.tscn" type="PackedScene" id=6] [node name="comm_station" type="Spatial"] script = ExtResource( 2 ) - -[node name="MeshInstance" type="MeshInstance" parent="."] -mesh = SubResource( 2 ) - -[node name="status_text" type="Label3D" parent="MeshInstance"] -unique_name_in_owner = true -transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 1.63295, -0.727839 ) -text = "Status: Broken" - -[node name="StaticBody" type="StaticBody" parent="."] - -[node name="CollisionShape" type="CollisionShape" parent="StaticBody"] -shape = SubResource( 3 ) +start_broken = true [node name="item_dump" parent="." instance=ExtResource( 1 )] unique_name_in_owner = true -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.87031, 0, 0 ) -collision_layer = 8 -collision_mask = 4 item_type_0 = ExtResource( 5 ) item_count_0 = 1 item_type_1 = ExtResource( 4 ) @@ -39,6 +21,18 @@ item_count_1 = 1 [node name="coin_machine" parent="." instance=ExtResource( 3 )] unique_name_in_owner = true +[node name="status_text" type="Label3D" parent="."] +unique_name_in_owner = true +transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 1.63295, -0.727839 ) +visible = false +text = "Status: Broken" + +[node name="status_light" parent="." instance=ExtResource( 6 )] +unique_name_in_owner = true +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.90735e-06, 1.34568, -0.13027 ) +omni_range = 1.547 +omni_attenuation = 0.5 + [connection signal="item_dump_completed" from="item_dump" to="." method="_on_item_dump_item_dump_completed"] [connection signal="item_dumped" from="item_dump" to="." method="_on_item_dump_item_dumped"] [connection signal="coin_requirement_met" from="coin_machine" to="." method="_on_coin_machine_coin_requirement_met"] diff --git a/scenes/main.tscn b/scenes/main.tscn index f9ef8eb..5aff2db 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -226,7 +226,13 @@ omni_range = 5.893 omni_attenuation = 2.0 [node name="light_comms" type="OmniLight" parent="lights"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -16.3, 3.329, 0 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -16.3229, 3.329, 2.87957 ) +shadow_enabled = true +omni_range = 5.893 +omni_attenuation = 2.0 + +[node name="light_comms2" type="OmniLight" parent="lights"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -16.4982, 3.329, -2.62727 ) shadow_enabled = true omni_range = 5.893 omni_attenuation = 2.0 @@ -377,11 +383,12 @@ transform = Transform( -0.0426527, 0.000404372, 0.999089, -0.000747618, 1, -0.00 [node name="Room_Label" type="Label3D" parent="Communications"] transform = Transform( 4, 0, 0, 0, 4, 2.32831e-10, 0, 0, 4, 0, 4.309, 0 ) +visible = false modulate = Color( 0, 0, 0, 1 ) text = "Communications" [node name="comm_station" parent="Communications" instance=ExtResource( 13 )] -transform = Transform( 1, 3.49246e-10, -2.23517e-08, -3.49246e-10, 1, 1.60071e-10, 2.23517e-08, 1.78261e-10, 1, 0.664039, 5.58794e-09, -7.58252 ) +transform = Transform( 1, 6.98492e-10, -8.19564e-08, -1.45519e-09, 1, 5.78439e-10, 8.19564e-08, 5.16593e-10, 1, 4.95462, -1.62981e-09, -9.93224 ) [node name="Rover_Room" type="Spatial" parent="."] transform = Transform( -0.707107, 0, 0.707107, 0, 1, 0, -0.707107, 0, -0.707107, -11, 0, 11 ) diff --git a/scripts/comm_station/comm_station.gd b/scripts/comm_station/comm_station.gd index 4a63840..346a589 100644 --- a/scripts/comm_station/comm_station.gd +++ b/scripts/comm_station/comm_station.gd @@ -1,7 +1,7 @@ -extends Spatial +extends Damageable const StateIdle = preload("res://scripts/comm_station/state/idle.gd") -const StateBlocked = preload("res://scripts/comm_station/state/blocked.gd") +const StateBroken = preload("res://scripts/comm_station/state/broken.gd") var state = null @@ -10,9 +10,10 @@ signal comms_established onready var coin_machine = $"%coin_machine" onready var item_dump = $"%item_dump" onready var status_text = $"%status_text" +onready var status_light = $"%status_light" func _ready(): - state = StateBlocked.new() + state = StateBroken.new() if start_broken else StateIdle.new() state.ctx = self state.enter_from(null) print("comms_station: NULL -> ", state.NAME) @@ -33,5 +34,9 @@ func _on_item_dump_item_dump_completed(): func _on_item_dump_item_dumped(): state.on_item_dump_item_dumped() +func take_damage(damage : int = 1): + .take_damage(damage) + state.on_damage_taken() + func emit_signal_comms_established(): emit_signal("comms_established") diff --git a/scripts/comm_station/state/blocked.gd b/scripts/comm_station/state/broken.gd similarity index 78% rename from scripts/comm_station/state/blocked.gd rename to scripts/comm_station/state/broken.gd index 5084c53..cb6e109 100644 --- a/scripts/comm_station/state/blocked.gd +++ b/scripts/comm_station/state/broken.gd @@ -1,6 +1,6 @@ extends Reference -const NAME = "blocked" +const NAME = "broken" var ctx = null @@ -11,6 +11,7 @@ func enter_from(state): ctx.coin_machine.enabled = false ctx.item_dump.enabled = true ctx.status_text.text = "Offline. Needs Repair" + ctx.status_light.fail() func exit_to(state): pass @@ -23,3 +24,6 @@ func on_item_dump_item_dump_completed(): func on_item_dump_item_dumped(): print("item dumped") + +func on_damage_taken(): + assert(false, "should be impossible in blocked state") diff --git a/scripts/comm_station/state/idle.gd b/scripts/comm_station/state/idle.gd index 7630dce..410e893 100644 --- a/scripts/comm_station/state/idle.gd +++ b/scripts/comm_station/state/idle.gd @@ -11,11 +11,13 @@ func enter_from(state): ctx.coin_machine.enabled = true ctx.item_dump.enabled = false ctx.status_text.text = "Online" + ctx.status_light.idle() func exit_to(state): pass func on_coin_machine_coin_requirement_met(player): + ctx.status_light.activate() ctx.emit_signal_comms_established() func on_item_dump_item_dump_completed(): @@ -23,3 +25,7 @@ func on_item_dump_item_dump_completed(): func _on_item_dump_item_dumped(): assert(false, "item dump should be disabled in idle state") + +func on_damage_taken(): + if ctx.current_hp <= 0: + ctx.change_state(ctx.StateBroken.new())