From c76634285bf50621e3c0ff96bf160a50733a4ff3 Mon Sep 17 00:00:00 2001 From: PfandBoss <68470553+PfandBoss@users.noreply.github.com> Date: Sat, 10 Dec 2022 02:35:47 +0100 Subject: [PATCH 1/4] JA --- Module.tscn | 7 ++----- Nodes/cannon.tscn | 6 ++++++ Nodes/game.tscn | 4 ++-- cannon.tscn | 6 ------ project.godot | 8 ++++---- Cannon.gd => scripts/Modules/Cannon.gd | 3 ++- Engine.gd => scripts/Modules/Engine.gd | 0 Module.gd => scripts/Modules/Module.gd | 0 Storage.gd => scripts/Modules/Storage.gd | 0 9 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 Nodes/cannon.tscn delete mode 100644 cannon.tscn rename Cannon.gd => scripts/Modules/Cannon.gd (92%) rename Engine.gd => scripts/Modules/Engine.gd (100%) rename Module.gd => scripts/Modules/Module.gd (100%) rename Storage.gd => scripts/Modules/Storage.gd (100%) diff --git a/Module.tscn b/Module.tscn index ac2c192..fb3efd7 100644 --- a/Module.tscn +++ b/Module.tscn @@ -1,6 +1,3 @@ -[gd_scene load_steps=2 format=3 uid="uid://b87b68ghm4dkk"] +[gd_scene load_steps=2 format=3] -[ext_resource type="Script" path="res://Module.gd" id="1_42v8k"] - -[node name="Node" type="Node"] -script = ExtResource("1_42v8k") +[ext_resource type="Script" path="res://scripts/Modules/Module.gd" id="1_42v8k"] diff --git a/Nodes/cannon.tscn b/Nodes/cannon.tscn new file mode 100644 index 0000000..6782155 --- /dev/null +++ b/Nodes/cannon.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://kupfq75m0v37"] + +[ext_resource type="Script" path="res://scripts/Modules/Cannon.gd" id="1_vdn0s"] + +[node name="Cannon" type="Node"] +script = ExtResource("1_vdn0s") diff --git a/Nodes/game.tscn b/Nodes/game.tscn index 02ab0d0..8bf6463 100644 --- a/Nodes/game.tscn +++ b/Nodes/game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=3 uid="uid://n7w0ff7u25yc"] +[gd_scene load_steps=5 format=3 uid="uid://bl1yrgr7g06db"] [ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_iox18"] @@ -42,7 +42,7 @@ skeleton = NodePath("../..") curve = SubResource("Curve3D_ycdkn") [node name="PathFollow3D" type="PathFollow3D" parent="Player2Path"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -16) +transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, -16) [node name="root" type="Node3D" parent="Player2Path/PathFollow3D"] transform = Transform3D(-0.0154456, -6.75146e-10, -0.999881, -5.21344e-12, 1, -6.75146e-10, 0.999881, -5.21341e-12, -0.0154456, 0, 0, 0) diff --git a/cannon.tscn b/cannon.tscn deleted file mode 100644 index 4c528ea..0000000 --- a/cannon.tscn +++ /dev/null @@ -1,6 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://d2g0of2prwwj4"] - -[ext_resource type="Script" path="res://Cannon.gd" id="1_mopo1"] - -[node name="Cannon" type="Node"] -script = ExtResource("1_mopo1") diff --git a/project.godot b/project.godot index 401df3a..6943375 100644 --- a/project.godot +++ b/project.godot @@ -12,22 +12,22 @@ _global_script_classes=[{ "base": "Module", "class": &"Cannon", "language": &"GDScript", -"path": "res://Cannon.gd" +"path": "res://scripts/Modules/Cannon.gd" }, { "base": "Node", "class": &"Module", "language": &"GDScript", -"path": "res://Module.gd" +"path": "res://scripts/Modules/Module.gd" }, { "base": "Module", "class": &"Storage", "language": &"GDScript", -"path": "res://Storage.gd" +"path": "res://scripts/Modules/Storage.gd" }, { "base": "Module", "class": &"TrainEngine", "language": &"GDScript", -"path": "res://Engine.gd" +"path": "res://scripts/Modules/Engine.gd" }] _global_script_class_icons={ "Cannon": "", diff --git a/Cannon.gd b/scripts/Modules/Cannon.gd similarity index 92% rename from Cannon.gd rename to scripts/Modules/Cannon.gd index 56a55e5..55a95d3 100644 --- a/Cannon.gd +++ b/scripts/Modules/Cannon.gd @@ -7,7 +7,7 @@ enum STATE {INACTIVE, RELOADING, SHOOTING} #------------Methods-------------# func _ready(): var root = get_tree().root.get_child(0) - root.shooting.connect(_on_signal_shooting) + root.shoot.connect(_on_signal_shooting) maxStashValue = 1 currentStashValue = 0 currentState = STATE.INACTIVE @@ -23,6 +23,7 @@ func interact(): return func _on_signal_shooting(): + print("hit") if currentStashValue >= 1 and currentState == STATE.INACTIVE: currentState = STATE.SHOOTING --currentStashValue diff --git a/Engine.gd b/scripts/Modules/Engine.gd similarity index 100% rename from Engine.gd rename to scripts/Modules/Engine.gd diff --git a/Module.gd b/scripts/Modules/Module.gd similarity index 100% rename from Module.gd rename to scripts/Modules/Module.gd diff --git a/Storage.gd b/scripts/Modules/Storage.gd similarity index 100% rename from Storage.gd rename to scripts/Modules/Storage.gd From 2a46b39a4da9141a27733a311844a11f0aa9a71a Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 10 Dec 2022 03:02:44 +0100 Subject: [PATCH 2/4] Summary (required) --- Cannon.gd | 4 ++-- Engine.gd | 1 - Storage.gd | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Cannon.gd b/Cannon.gd index 56a55e5..e392237 100644 --- a/Cannon.gd +++ b/Cannon.gd @@ -17,7 +17,7 @@ func interact(): #TODO: RELOADING if currentStashValue < maxStashValue: currentState = STATE.RELOADING - ++currentStashValue + currentStashValue += 1 return return @@ -25,7 +25,7 @@ func interact(): func _on_signal_shooting(): if currentStashValue >= 1 and currentState == STATE.INACTIVE: currentState = STATE.SHOOTING - --currentStashValue + currentStashValue -= 1 #TODO: SHOOTING currentState = STATE.INACTIVE return diff --git a/Engine.gd b/Engine.gd index 760d79e..58ac3e6 100644 --- a/Engine.gd +++ b/Engine.gd @@ -17,7 +17,6 @@ func interact(): currentStashValue += 10 if currentStashValue > maxStashValue: currentStashValue = maxStashValue - return #TODO: Repair Train currentState = STATE.RUNNING diff --git a/Storage.gd b/Storage.gd index 840cc53..bf5142d 100644 --- a/Storage.gd +++ b/Storage.gd @@ -14,10 +14,10 @@ func _ready(): currentStashValue = 0 func interact(): if currentStashValue >= 1: - --currentStashValue + currentStashValue -= 1 return func _on_signal_storing(): if currentStashValue < maxStashValue: - ++currentStashValue + currentStashValue += 1 return From 701f0bfee903aefcd99d07a74e23e86b95f12377 Mon Sep 17 00:00:00 2001 From: PfandBoss <68470553+PfandBoss@users.noreply.github.com> Date: Sat, 10 Dec 2022 03:18:55 +0100 Subject: [PATCH 3/4] idc --- Storage.tscn | 7 +++++++ scripts/Modules/Storage.gd | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 Storage.tscn diff --git a/Storage.tscn b/Storage.tscn new file mode 100644 index 0000000..ae3b755 --- /dev/null +++ b/Storage.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://1sr52olklfyy"] + +[ext_resource type="Script" path="res://scripts/Modules/Storage.gd" id="1_guwoh"] + +[node name="Storage" type="Node"] +script = ExtResource("1_guwoh") +currentType = 0 diff --git a/scripts/Modules/Storage.gd b/scripts/Modules/Storage.gd index bf5142d..54f8ac7 100644 --- a/scripts/Modules/Storage.gd +++ b/scripts/Modules/Storage.gd @@ -9,15 +9,15 @@ enum TYPE {AMMO, GUNPOWDER, FUEL} #------------Methods-------------# func _ready(): var root = get_tree().root.get_child(0) - root.shooting.connect(_on_signal_storing) + root.ammo_pickup.connect(_on_signal_storing) maxStashValue = 5 currentStashValue = 0 func interact(): if currentStashValue >= 1: - currentStashValue -= 1 + --currentStashValue return func _on_signal_storing(): if currentStashValue < maxStashValue: - currentStashValue += 1 + ++currentStashValue return From d427fa82f1bb77b322603a02333d768459e69ba5 Mon Sep 17 00:00:00 2001 From: Arthur Date: Sat, 10 Dec 2022 03:20:51 +0100 Subject: [PATCH 4/4] Update Storage.gd --- scripts/Modules/Storage.gd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Modules/Storage.gd b/scripts/Modules/Storage.gd index 54f8ac7..baf1804 100644 --- a/scripts/Modules/Storage.gd +++ b/scripts/Modules/Storage.gd @@ -14,10 +14,10 @@ func _ready(): currentStashValue = 0 func interact(): if currentStashValue >= 1: - --currentStashValue + currentStashValue -= 1 return func _on_signal_storing(): if currentStashValue < maxStashValue: - ++currentStashValue + currentStashValue += 1 return