diff --git a/scenes/player.tscn b/scenes/player.tscn index a367142..47d0f53 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://dpsr6ug3pkb40"] +[gd_scene load_steps=15 format=3 uid="uid://dpsr6ug3pkb40"] [ext_resource type="Script" uid="uid://3dphlay25fih" path="res://scripts/player/player.gd" id="1_g2els"] [ext_resource type="Script" uid="uid://dalwlndejfdhm" path="res://scripts/player/crosshair.gd" id="3_dqkch"] @@ -6,6 +6,7 @@ [ext_resource type="PackedScene" uid="uid://c3hg4ux4j76j2" path="res://models/molikman_hands.glb" id="4_dqkch"] [ext_resource type="Script" uid="uid://6c14qse4vnra" path="res://scripts/player/player_raycast.gd" id="4_fjrip"] [ext_resource type="Script" uid="uid://bmecgup3kcua7" path="res://scripts/weapon_system/weapon_system.gd" id="4_qlg0r"] +[ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://scenes/weapons/starting_pistol.tscn" id="7_fjrip"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_u8vuu"] @@ -249,7 +250,13 @@ replication_config = SubResource("SceneReplicationConfig_qhqgy") [node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("default_pistol", "animation_player")] script = ExtResource("4_qlg0r") -default_pistol = NodePath("") +default_pistol = NodePath("StartingPistol") animation_player = NodePath("../Camera3D/molikman_hands/AnimationPlayer") +[node name="StartingPistol" parent="WeaponSystem" instance=ExtResource("7_fjrip")] + +[node name="Shoot" parent="WeaponSystem/StartingPistol" index="1" node_paths=PackedStringArray("raycast")] +raycast = NodePath("../../../Camera3D/RayCast3D") + [editable path="Camera3D/molikman_hands"] +[editable path="WeaponSystem/StartingPistol"] diff --git a/scenes/weapons/starting_pistol.tscn b/scenes/weapons/starting_pistol.tscn index 12fa1b1..83fe92d 100644 --- a/scenes/weapons/starting_pistol.tscn +++ b/scenes/weapons/starting_pistol.tscn @@ -15,14 +15,20 @@ metadata/_custom_type_script = "uid://e6lqknfl4ngt" [node name="Idle" type="Node" parent="."] script = ExtResource("2_cmn6f") +emptyable = true -[node name="Shoot" type="Node" parent="."] +[node name="Shoot" type="Node" parent="." node_paths=PackedStringArray("fire_timer")] script = ExtResource("3_016ti") +emptyable = true +damage = 22 +fire_timer = NodePath("../FireTimer") [node name="Reload" type="Node" parent="."] script = ExtResource("4_hoqxt") +emptyable = true [node name="Intro" type="Node" parent="."] script = ExtResource("5_ud1dr") +emptyable = true [node name="FireTimer" type="Timer" parent="."] diff --git a/scripts/state_machine/state.gd b/scripts/state_machine/state.gd index e999a02..4276beb 100644 --- a/scripts/state_machine/state.gd +++ b/scripts/state_machine/state.gd @@ -3,6 +3,8 @@ extends Node class_name State +@warning_ignore_start("unused_signal","unused_parameter") + signal transition(to: StringName) @abstract func enter() -> void diff --git a/scripts/weapon_system/gun/idle_state.gd b/scripts/weapon_system/gun/idle_state.gd index 50a47c8..f1d7398 100644 --- a/scripts/weapon_system/gun/idle_state.gd +++ b/scripts/weapon_system/gun/idle_state.gd @@ -23,4 +23,4 @@ func init_reload(): transition.emit("Reload") func with_morphems(animation): - return machine.animation_prefix + (animation+"_empty") if emptyable and machine.ammo == 0 else animation + return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) diff --git a/scripts/weapon_system/gun/intro_state.gd b/scripts/weapon_system/gun/intro_state.gd index 1ff258b..2d41843 100644 --- a/scripts/weapon_system/gun/intro_state.gd +++ b/scripts/weapon_system/gun/intro_state.gd @@ -14,4 +14,4 @@ func on_animation_finished(animation): transition.emit("Idle") func with_morphems(animation): - return machine.animation_prefix + (animation+"_empty") if emptyable and machine.ammo == 0 else animation + return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) diff --git a/scripts/weapon_system/gun/reload_state.gd b/scripts/weapon_system/gun/reload_state.gd index 410da29..6abafee 100644 --- a/scripts/weapon_system/gun/reload_state.gd +++ b/scripts/weapon_system/gun/reload_state.gd @@ -15,4 +15,4 @@ func on_animation_finished(animation): transition.emit("Idle") func with_morphems(animation): - return machine.animation_prefix + (animation+"_empty") if emptyable and machine.ammo == 0 else animation + return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) diff --git a/scripts/weapon_system/gun/semi_auto_shoot_state.gd b/scripts/weapon_system/gun/semi_auto_shoot_state.gd index d788a95..483f49c 100644 --- a/scripts/weapon_system/gun/semi_auto_shoot_state.gd +++ b/scripts/weapon_system/gun/semi_auto_shoot_state.gd @@ -36,4 +36,4 @@ func fire() -> void: fire_timer.start() func with_morphems(animation): - return machine.animation_prefix + (animation+"_empty") if emptyable and machine.ammo == 0 else animation + return machine.animation_prefix + ((animation+"_empty") if emptyable and machine.ammo == 0 else animation) diff --git a/scripts/weapon_system/weapon_system.gd b/scripts/weapon_system/weapon_system.gd index 6eccf47..8e19598 100644 --- a/scripts/weapon_system/weapon_system.gd +++ b/scripts/weapon_system/weapon_system.gd @@ -34,7 +34,6 @@ func _ready() -> void: slots["knife"] = default_knife slots["secondary"] = default_pistol current_state.enter() - current_state.in_use = true func can_add(slot: StringName) -> bool: return slots.has(slot)