Skip to content

Commit

Permalink
Add RESTORE spell, portal (Item)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheActualTwinkle committed Apr 6, 2023
1 parent 06ba4b1 commit d20b396
Show file tree
Hide file tree
Showing 14 changed files with 2,703 additions and 27 deletions.
4 changes: 3 additions & 1 deletion player/player.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=3 uid="uid://bd3b3ca374ji6"]
[gd_scene load_steps=20 format=3 uid="uid://bd3b3ca374ji6"]

[ext_resource type="Script" path="res://player/player.gd" id="1_khcw2"]
[ext_resource type="Environment" uid="uid://biqvtjsci1ld8" path="res://player/material_env.tres" id="2_5bh7t"]
Expand All @@ -10,6 +10,7 @@
[ext_resource type="Script" path="res://player/speech_recognition.gd" id="6_gxi0n"]
[ext_resource type="PackedScene" uid="uid://die2clnm3gt6u" path="res://spells/water_spell.tscn" id="7_wwpun"]
[ext_resource type="PackedScene" uid="uid://bdptjf5n1xaqu" path="res://spells/wind_spell.tscn" id="8_f7els"]
[ext_resource type="PackedScene" uid="uid://y8o54gbbmy7x" path="res://spells/repair_spell.tscn" id="11_mvv62"]

[sub_resource type="Animation" id="Animation_cepqe"]
resource_name = "RESET"
Expand Down Expand Up @@ -258,5 +259,6 @@ script = ExtResource("5_jpbmn")
fire_spell_scene = ExtResource("6_7r8ka")
water_spell_scene = ExtResource("7_wwpun")
wind_spell_scene = ExtResource("8_f7els")
repair_spell_scene = ExtResource("11_mvv62")

[connection signal="timeout" from="Head/SpeechRecognition/Timer" to="Head/SpeechRecognition" method="_on_timer_timeout"]
8 changes: 5 additions & 3 deletions player/speech_recognition.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extends Node
"fire": Globals.SpellType.FIRE,
"death": Globals.SpellType.WATER,
"meat": Globals.SpellType.WIND,
"magic": Globals.SpellType.REPAIR
}

var effect: AudioEffect
Expand All @@ -14,13 +15,14 @@ var thread: Thread

var path: String

var max_record_time = 5.0 # sec.
var max_record_time: float = 5.0 # sec.

func _exit_tree():
thread.wait_to_finish()
if thread != null:
thread.wait_to_finish()

func _ready() -> void:
timer.wait_time = max_record_time
timer.set_wait_time(max_record_time)

path = get_directory()

Expand Down
5 changes: 4 additions & 1 deletion player/spell_caster.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ signal casted(spell: Spell)
@export var fire_spell_scene: PackedScene
@export var water_spell_scene: PackedScene
@export var wind_spell_scene: PackedScene
@export var repair_spell_scene: PackedScene
@onready var head: Node3D = $"../Head"

var choosen_spell_type: Globals.SpellType = -1
Expand All @@ -15,7 +16,7 @@ func choose(spell_type: Globals.SpellType) -> void:
if can_conjure() == false:
return

if spell_type == -1 or World.current_plane == Globals.WorldPlane.MATERIAL:
if spell_type == -1:
return

choosen_spell_type = spell_type
Expand Down Expand Up @@ -51,6 +52,8 @@ func get_spell(spell_type: Globals.SpellType) -> Spell:
return water_spell_scene.instantiate()
Globals.SpellType.WIND:
return wind_spell_scene.instantiate()
Globals.SpellType.REPAIR:
return repair_spell_scene.instantiate()
_:
return null

Expand Down
3 changes: 2 additions & 1 deletion singletons/globals.gd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum WorldPlane {
enum SpellType{
FIRE,
WATER,
WIND
WIND,
REPAIR
}

const WORLD_OFFSET = Vector3(0.0, 100.0, 0.0)
4 changes: 1 addition & 3 deletions spells/fire_spell.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[ext_resource type="Script" path="res://spells/spell.gd" id="1_tmxe3"]

[sub_resource type="SphereShape3D" id="SphereShape3D_huiik"]
radius = 0.25

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dl8c1"]
albedo_color = Color(1, 0.101961, 0, 1)
Expand All @@ -12,9 +13,6 @@ material = SubResource("StandardMaterial3D_dl8c1")

[node name="FireSpell" type="Area3D"]
script = ExtResource("1_tmxe3")
type = null
length = null
duration = null

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_huiik")
Expand Down
25 changes: 25 additions & 0 deletions spells/repair_spell.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[gd_scene load_steps=5 format=3 uid="uid://y8o54gbbmy7x"]

[ext_resource type="Script" path="res://spells/spell.gd" id="1_o34b4"]

[sub_resource type="SphereShape3D" id="SphereShape3D_tg254"]
radius = 0.25

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dl8c1"]
albedo_color = Color(1, 0.666667, 0, 1)

[sub_resource type="SphereMesh" id="SphereMesh_kuatd"]
material = SubResource("StandardMaterial3D_dl8c1")

[node name="repair_spell" type="Area3D"]
script = ExtResource("1_o34b4")
type = 3
length = 2.0

[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_tg254")

[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_kuatd")

[connection signal="area_entered" from="." to="." method="_on_area_entered"]
1 change: 1 addition & 0 deletions spells/water_spell.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[ext_resource type="Script" path="res://spells/spell.gd" id="1_s3d0n"]

[sub_resource type="SphereShape3D" id="SphereShape3D_huiik"]
radius = 0.25

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jgjlq"]
albedo_color = Color(0, 0.25098, 1, 1)
Expand Down
1 change: 1 addition & 0 deletions spells/wind_spell.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[ext_resource type="Script" path="res://spells/spell.gd" id="1_nry0b"]

[sub_resource type="SphereShape3D" id="SphereShape3D_huiik"]
radius = 0.25

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cvc8a"]

Expand Down
1,310 changes: 1,310 additions & 0 deletions world/items/portal/c_portal.tscn

Large diffs are not rendered by default.

1,310 changes: 1,310 additions & 0 deletions world/items/portal/m_portal.tscn

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions world/items/portal/portal.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
extends Item

@onready var body: StaticBody3D = $StaticBody3D
@onready var animator: AnimationPlayer = $AnimationPlayer

func interact(spell: Spell) -> void:
animator.play("Restore") # Norm anim nado.
disable_body() # Remove
interactable = false

func disable_body() -> void: # Invoke this at and of animation
body.queue_free()
4 changes: 2 additions & 2 deletions world/items/tree/tree.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ extends Item
@onready var animator: AnimationPlayer = $AnimationPlayer

func interact(spell: Spell) -> void:
animator.play("C_OldTree") # Norm anim nado.
body.queue_free() # Remove
animator.play("") # Norm anim nado.
disable_body() # Remove

func disable_body() -> void: # Invoke this at and of animation
body.queue_free()
41 changes: 26 additions & 15 deletions world/level/level.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[gd_scene load_steps=4 format=3 uid="uid://bb31djcios3dg"]
[gd_scene load_steps=6 format=3 uid="uid://bb31djcios3dg"]

[ext_resource type="PackedScene" uid="uid://dksoaqgf1t4cv" path="res://world/level/hub/hub.tscn" id="1_s678q"]
[ext_resource type="PackedScene" uid="uid://dr620hhhu6sdg" path="res://world/level/room_1/room_1.tscn" id="2_j7kwd"]
[ext_resource type="PackedScene" uid="uid://drcef7oxafw5i" path="res://world/items/portal/m_portal.tscn" id="3_hki5r"]
[ext_resource type="PackedScene" uid="uid://cigbjnel7u35e" path="res://world/teleport/teleport.tscn" id="3_m2yko"]
[ext_resource type="PackedScene" uid="uid://bstd3xy8rkkn7" path="res://world/items/portal/c_portal.tscn" id="6_r7yty"]

[node name="Level" type="Node3D"]

Expand All @@ -11,35 +13,44 @@
[node name="Room1" parent="." instance=ExtResource("2_j7kwd")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 100, 0, 0)

[node name="M_Teleports" type="Node3D" parent="."]
[node name="Material" type="Node3D" parent="."]

[node name="GateToRoom1" parent="M_Teleports" node_paths=PackedStringArray("destination_marker") instance=ExtResource("3_m2yko")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 5, 1, 4)
destination_marker = NodePath("../EntranceRoom1")
[node name="PortalToRoom1" parent="Material" instance=ExtResource("3_hki5r")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 4)

[node name="EntranceRoom1" type="Marker3D" parent="M_Teleports"]
[node name="teleport" parent="Material/PortalToRoom1" index="16" node_paths=PackedStringArray("destination_marker")]
destination_marker = NodePath("../../EntranceRoom1")

[node name="EntranceRoom1" type="Marker3D" parent="Material"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 98, 0, 0)

[node name="GateFromRoom1ToHub" parent="M_Teleports" node_paths=PackedStringArray("destination_marker") instance=ExtResource("3_m2yko")]
[node name="GateFromRoom1ToHub" parent="Material" node_paths=PackedStringArray("destination_marker") instance=ExtResource("3_m2yko")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 95, 1, 0)
destination_marker = NodePath("../EntranceHubFromRoom1")

[node name="EntranceHubFromRoom1" type="Marker3D" parent="M_Teleports"]
[node name="EntranceHubFromRoom1" type="Marker3D" parent="Material"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 4)

[node name="C_Teleports" type="Node3D" parent="."]
[node name="Cognitive" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 100, 0)

[node name="GateToRoom1" parent="C_Teleports" node_paths=PackedStringArray("destination_marker") instance=ExtResource("3_m2yko")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 5, 1, 4)
destination_marker = NodePath("../EntranceRoom1")
[node name="PortalToRoom1" parent="Cognitive" instance=ExtResource("6_r7yty")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, 4)

[node name="teleport" parent="Cognitive/PortalToRoom1" index="16" node_paths=PackedStringArray("destination_marker")]
destination_marker = NodePath("../../EntranceRoom1")

[node name="EntranceRoom1" type="Marker3D" parent="C_Teleports"]
[node name="EntranceRoom1" type="Marker3D" parent="Cognitive"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 98, 0, 0)

[node name="GateFromRoom1ToHub" parent="C_Teleports" node_paths=PackedStringArray("destination_marker") instance=ExtResource("3_m2yko")]
[node name="GateFromRoom1ToHub" parent="Cognitive" node_paths=PackedStringArray("destination_marker") instance=ExtResource("3_m2yko")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 95, 1, 0)
destination_marker = NodePath("../EntranceHubFromRoom1")

[node name="EntranceHubFromRoom1" type="Marker3D" parent="C_Teleports"]
[node name="EntranceHubFromRoom1" type="Marker3D" parent="Cognitive"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 4)

[editable path="Material/PortalToRoom1"]
[editable path="Material/PortalToRoom1/teleport"]
[editable path="Cognitive/PortalToRoom1"]
[editable path="Cognitive/PortalToRoom1/teleport"]
2 changes: 1 addition & 1 deletion world/teleport/teleport.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://world/teleport/teleport.gd" id="1_lmfdq"]

[sub_resource type="BoxShape3D" id="BoxShape3D_r3386"]
size = Vector3(2, 2, 2)
size = Vector3(0.332831, 1.35803, 1.00171)

[node name="teleport" type="Area3D"]
collision_layer = 0
Expand Down

0 comments on commit d20b396

Please sign in to comment.