Fixed double-crouching
This commit is contained in:
parent
dc472515c4
commit
c1548e5451
5 changed files with 12 additions and 15 deletions
|
|
@ -7636,6 +7636,7 @@ weapon_models = {
|
|||
|
||||
[node name="molikman_ingame" type="Node3D" parent="."]
|
||||
transform = Transform3D(0.75, 0, 0, 0, 0.74999994, 0, 0, 0, 0.74999994, 0, 1.1793717, 0)
|
||||
visible = false
|
||||
|
||||
[node name="Armature" type="Node3D" parent="molikman_ingame"]
|
||||
|
||||
|
|
@ -8106,10 +8107,6 @@ mesh = SubResource("ArrayMesh_aj0lc")
|
|||
skin = SubResource("Skin_53wat")
|
||||
surface_material_override/0 = ExtResource("26_r2jxp")
|
||||
|
||||
[node name="VisibleEnabler" type="Node" parent="molikman_ingame"]
|
||||
script = ExtResource("4_smehm")
|
||||
visible_for_others = true
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||
shape = SubResource("CapsuleShape3D_u8vuu")
|
||||
|
|
@ -8807,11 +8804,12 @@ player_movement = NodePath("../../PlayerMovement")
|
|||
player_input = NodePath("../../PlayerInput")
|
||||
weapon_system = NodePath("../../WeaponSystem")
|
||||
|
||||
[node name="Fall" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "weapon_system", "land_sound")]
|
||||
[node name="Fall" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "player_input", "weapon_system", "land_sound")]
|
||||
script = ExtResource("12_fulsm")
|
||||
acceleration = 25.0
|
||||
player = NodePath("../..")
|
||||
player_movement = NodePath("../../PlayerMovement")
|
||||
player_input = NodePath("../../PlayerInput")
|
||||
acceleration = 25.0
|
||||
weapon_system = NodePath("../../WeaponSystem")
|
||||
land_sound = NodePath("../../LandAudio")
|
||||
|
||||
|
|
@ -8872,7 +8870,6 @@ blue_team_texture = ExtResource("27_j3w78")
|
|||
replication_config = SubResource("SceneReplicationConfig_5amik")
|
||||
script = ExtResource("37_b2eak")
|
||||
|
||||
[connection signal="died" from="." to="molikman_ingame/VisibleEnabler" method="reverse"]
|
||||
[connection signal="died" from="." to="Camera3D" method="disable"]
|
||||
[connection signal="died" from="." to="Camera3D/DeadSpectator" method="set_active"]
|
||||
[connection signal="died" from="." to="BodyStateMachine/Death" method="on_death"]
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ extends State
|
|||
|
||||
@export var player: Player
|
||||
@export var player_movement: PlayerMovement
|
||||
@export var player_input: PlayerInput
|
||||
@export var max_speed: float = 5.0
|
||||
@export var acceleration: float
|
||||
@export var weapon_system: WeaponSystem
|
||||
|
|
@ -18,7 +19,12 @@ func physics_update(delta: float) -> void:
|
|||
if not is_multiplayer_authority():
|
||||
return
|
||||
if player.is_on_floor():
|
||||
transition.emit("Stand")
|
||||
if player_input.compressed_states & PlayerInput.CROUCH:
|
||||
transition.emit("Crouch")
|
||||
elif player_input.compressed_states & PlayerInput.WALK:
|
||||
transition.emit("Walk")
|
||||
else:
|
||||
transition.emit("Stand")
|
||||
land_sound.multiplayer_play()
|
||||
|
||||
player.velocity += player.get_gravity() * delta
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@ func enter() -> void:
|
|||
player_input.jumped.connect(on_jumped)
|
||||
player_input.crouch_begin.connect(begin_crouch)
|
||||
player_input.walk_begin.connect(begin_walk)
|
||||
if player_input.compressed_states & PlayerInput.CROUCH:
|
||||
begin_crouch()
|
||||
elif player_input.compressed_states & PlayerInput.WALK:
|
||||
begin_walk()
|
||||
|
||||
func exit() -> void:
|
||||
player_input.jumped.disconnect(on_jumped)
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ func enter() -> void:
|
|||
player_input.crouch_begin.connect(begin_crouch)
|
||||
player_input.walk_end.connect(end_walk)
|
||||
player_input.jumped.connect(on_jumped)
|
||||
if player_input.compressed_states & PlayerInput.CROUCH:
|
||||
begin_crouch()
|
||||
|
||||
func exit() -> void:
|
||||
player_input.crouch_begin.disconnect(begin_crouch)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ func change_state(to_state: State) -> void:
|
|||
current_state = to_state
|
||||
current_state.enter()
|
||||
|
||||
@rpc
|
||||
@rpc("authority","call_local","reliable")
|
||||
func change_state_to_name(to_name: StringName):
|
||||
if current_state != null:
|
||||
current_state.exit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue