diff --git a/first-person-ascii-art-demo/Interactables/FirePedestal.gd b/first-person-ascii-art-demo/Interactables/FirePedestal.gd index 9a13e79..9cb5b9b 100644 --- a/first-person-ascii-art-demo/Interactables/FirePedestal.gd +++ b/first-person-ascii-art-demo/Interactables/FirePedestal.gd @@ -12,8 +12,8 @@ signal off func _ready(): - pass - # animation_player.seek(0.0, true) + if lit: + particles.emitting = true func handle_command(command,interaction_caller): @@ -21,22 +21,20 @@ func handle_command(command,interaction_caller): if animation_player.is_playing(): return false - print(interaction_caller.item_in_inventory) + # If player has a torch if (command == "light" or 1 == 1) and \ not interaction_caller.item_in_inventory == null and \ - interaction_caller.item_in_inventory.is_in_group("fire") and \ - interaction_caller.item_in_inventory.get("on") == true: + interaction_caller.item_in_inventory.is_in_group("fire"): - animation_player.play("Activated") - self.lit = true - - emit_signal("on") - - #black_board["activated_pillars"] += 1 - #if black_board["activated_pillars"] == 1: - # print("test1") - - return true + if interaction_caller.item_in_inventory.on == true: + #animation_player.play("Activated") + self.lit = true + emit_signal("on") + return true + elif self.lit: + interaction_caller.item_in_inventory.on = true + return true + return false diff --git a/first-person-ascii-art-demo/Interactables/Torch.gd b/first-person-ascii-art-demo/Interactables/Torch.gd index 7667d20..519633e 100644 --- a/first-person-ascii-art-demo/Interactables/Torch.gd +++ b/first-person-ascii-art-demo/Interactables/Torch.gd @@ -1,7 +1,8 @@ extends Spatial -export var on = false +export var on = false setget set_on +onready var torchlight = $TorchLight var state = 0 @@ -23,7 +24,7 @@ func _on_Interactable_interacted(interaction_string,interaction_caller): if interaction_string == "drop": interaction_caller.de_equip_item(self) if interaction_string == "use" or state == 1: - if on and 0 == 1: + if not on: $TorchLight.hide() else: $TorchLight.show() @@ -31,7 +32,13 @@ func _on_Interactable_interacted(interaction_string,interaction_caller): state = 2 - - +func set_on(val): + if torchlight: + if val: + $TorchLight.show() + else: + $TorchLight.hide() + on = val + func _on_RandomTimer_timeout(): pass # Replace with function body. diff --git a/first-person-ascii-art-demo/Interactables/TorchHolder.gd b/first-person-ascii-art-demo/Interactables/TorchHolder.gd index ae2bf47..2098ff3 100644 --- a/first-person-ascii-art-demo/Interactables/TorchHolder.gd +++ b/first-person-ascii-art-demo/Interactables/TorchHolder.gd @@ -17,4 +17,10 @@ func _ready(): func _on_Interactable_interacted(interaction_string, interaction_caller): - pass # Replace with function body. + if (interaction_string == "light" or 1 == 1) and \ + not interaction_caller.item_in_inventory == null and \ + interaction_caller.item_in_inventory.is_in_group("fire"): + + + interaction_caller.item_in_inventory.on = true + return true diff --git a/first-person-ascii-art-demo/RoomScenes/EntryRoom/EntryRoom.tscn b/first-person-ascii-art-demo/RoomScenes/EntryRoom/EntryRoom.tscn index 651097e..842ea8f 100644 --- a/first-person-ascii-art-demo/RoomScenes/EntryRoom/EntryRoom.tscn +++ b/first-person-ascii-art-demo/RoomScenes/EntryRoom/EntryRoom.tscn @@ -47,6 +47,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.95446, -0.329587, 0 ) [node name="FirePedestal2" parent="." instance=ExtResource( 4 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.84193, -0.329587, 0 ) +lit = true [node name="Torch" parent="." instance=ExtResource( 3 )] transform = Transform( -3.21965e-08, -0.736569, 0.676362, 1, -4.37114e-08, 0, 2.95647e-08, 0.676362, 0.736569, -4.46896, 0.087595, -5.95753 ) diff --git a/first-person-ascii-art-demo/RoomScenes/GameWorld.tscn b/first-person-ascii-art-demo/RoomScenes/GameWorld.tscn index 7b8c176..e9d0436 100644 --- a/first-person-ascii-art-demo/RoomScenes/GameWorld.tscn +++ b/first-person-ascii-art-demo/RoomScenes/GameWorld.tscn @@ -165,10 +165,10 @@ tracks/1/loop_wrap = true tracks/1/imported = false tracks/1/enabled = true tracks/1/keys = { -"times": PoolRealArray( 4.09782e-08, 1, 2.5, 3 ), -"transitions": PoolRealArray( 1, 1, 1, 1 ), +"times": PoolRealArray( 1, 2.5, 3 ), +"transitions": PoolRealArray( 1, 1, 1 ), "update": 0, -"values": [ Vector3( 155.065, 0.18312, 61.9813 ), Vector3( 152.27, -2.17126, 61.0024 ), Vector3( 150.12, -2.18153, 57.8075 ), Vector3( 148.025, -3.21886, 57.8075 ) ] +"values": [ Vector3( 152.27, -2.17126, 61.0024 ), Vector3( 150.12, -2.18153, 57.8075 ), Vector3( 148.025, -3.21886, 57.8075 ) ] } tracks/2/type = "value" tracks/2/path = NodePath("Player:rotation_degrees") @@ -177,10 +177,10 @@ tracks/2/loop_wrap = true tracks/2/imported = false tracks/2/enabled = true tracks/2/keys = { -"times": PoolRealArray( 0, 1, 2.5 ), -"transitions": PoolRealArray( 1, 1, 1 ), +"times": PoolRealArray( 1, 2.5 ), +"transitions": PoolRealArray( 1, 1 ), "update": 0, -"values": [ Vector3( 10, -90, 0 ), Vector3( 0, 90, 0 ), Vector3( -30, 90, 0 ) ] +"values": [ Vector3( 0, 90, 0 ), Vector3( -30, 90, 0 ) ] } [sub_resource type="BoxShape" id=5] @@ -190,7 +190,7 @@ extents = Vector3( 1.32968, 1, 1 ) script = ExtResource( 7 ) [node name="Player" parent="." instance=ExtResource( 1 )] -transform = Transform( -1.62921e-07, -0.173648, -0.984807, 0, 0.984808, -0.173648, 1, -2.82909e-08, -1.60445e-07, 155.065, 0.18312, 61.9813 ) +transform = Transform( -1, 0, -8.74227e-08, 0, 1, 0, 8.74228e-08, 0, -0.999999, -0.737334, 0, -6.25559 ) [node name="SpotLight" type="SpotLight" parent="."] transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 10, 0 ) @@ -218,7 +218,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -3.98091, 0, 2.42827 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.54793, -8.10181 ) [node name="LightMaze" parent="." instance=ExtResource( 5 )] -transform = Transform( -0.999983, 0, -0.00584672, 0, 1, 0, 0.00584672, 0, -0.999983, -5.81547, -2.426, 83.6999 ) +transform = Transform( -0.999983, 0, -0.00584672, 0, 1, 0, 0.00584672, 0, -0.999983, -5.81547, -2.426, 83.244 ) [node name="WorldItems" type="Spatial" parent="."]