Player movement rework

This commit is contained in:
Rendo 2025-11-26 21:04:38 +05:00
commit 7bbeebdd2e
11 changed files with 190 additions and 73 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://dpsr6ug3pkb40"]
[gd_scene load_steps=22 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"]
@ -8,7 +8,12 @@
[ext_resource type="Script" uid="uid://bmecgup3kcua7" path="res://scripts/weapon_system/weapon_system.gd" id="4_qlg0r"]
[ext_resource type="Script" uid="uid://dd5mp72dq43v6" path="res://scripts/multiplayer/own_visibility_toggle.gd" id="4_smehm"]
[ext_resource type="PackedScene" uid="uid://djwjl8xll53vn" path="res://scenes/weapons/starting_pistol.tscn" id="7_fjrip"]
[ext_resource type="Script" uid="uid://3777rkbebgjm" path="res://scripts/state_machine/machine.gd" id="8_f1ej7"]
[ext_resource type="PackedScene" uid="uid://c2r8dbudbs7l3" path="res://models/molikman_ingame.glb" id="8_smehm"]
[ext_resource type="Script" uid="uid://bv8sgx78s8hwn" path="res://scripts/player/states/crouching.gd" id="9_oprun"]
[ext_resource type="Script" uid="uid://u0e2b2mvij1k" path="res://scripts/player/states/standing.gd" id="10_a8ls1"]
[ext_resource type="Script" uid="uid://cwasvwhm5yg0o" path="res://scripts/player/states/walk.gd" id="11_qfm1y"]
[ext_resource type="Script" uid="uid://cq4i0afwesdm3" path="res://scripts/player/states/falling.gd" id="12_fulsm"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_u8vuu"]
@ -120,12 +125,9 @@ properties/4/path = NodePath(".:hp")
properties/4/spawn = true
properties/4/replication_mode = 1
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("animation_player", "stand_up_area")]
[node name="Player" type="CharacterBody3D"]
collision_layer = 2
script = ExtResource("1_g2els")
animation_player = NodePath("AnimationPlayer")
stand_up_area = NodePath("StandArea")
CROUCH_TIME = 0.1
[node name="molikman_ingame" parent="." instance=ExtResource("8_smehm")]
transform = Transform3D(0.75, 0, 0, 0, 0.75, 0, 0, 0, 0.75, 0, 1.1793717, 0)
@ -262,6 +264,30 @@ crosses_offset = 3.0
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_qhqgy")
[node name="BodyStateMachine" type="Node" parent="." node_paths=PackedStringArray("current_state")]
script = ExtResource("8_f1ej7")
current_state = NodePath("Stand")
metadata/_custom_type_script = "uid://3777rkbebgjm"
[node name="Crouch" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("stand_up_area", "player", "animation_player")]
script = ExtResource("9_oprun")
stand_up_area = NodePath("../../StandArea")
player = NodePath("../..")
animation_player = NodePath("../../AnimationPlayer")
[node name="Stand" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player")]
script = ExtResource("10_a8ls1")
player = NodePath("../..")
[node name="Walk" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player")]
script = ExtResource("11_qfm1y")
player = NodePath("../..")
[node name="Fall" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player")]
script = ExtResource("12_fulsm")
player = NodePath("../..")
SPEED = 5.0
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("default_pistol", "animation_player", "camera")]
script = ExtResource("4_qlg0r")
default_pistol = NodePath("StartingPistol")