Compare commits
5 Commits
f3e196451e
...
bb9ed38278
| Author | SHA1 | Date | |
|---|---|---|---|
| bb9ed38278 | |||
| 4512734395 | |||
| 9756572ccf | |||
| efa350ff20 | |||
| f162da8a41 |
@ -52,3 +52,4 @@ stream = ExtResource("1_uh1ab")
|
||||
|
||||
[node name="walk" type="AudioStreamPlayer3D" parent="." unique_id=1589803505]
|
||||
stream = SubResource("AudioStreamRandomizer_uh1ab")
|
||||
max_distance = 20.0
|
||||
|
||||
@ -46,4 +46,11 @@ impl PlayerEffects {
|
||||
}
|
||||
self.walk_sfx_cd_remaining = self.walk_sfx_cd;
|
||||
}
|
||||
|
||||
pub fn jump(&mut self) {
|
||||
if let Some(walk) = &mut self.walk_sound {
|
||||
walk.play();
|
||||
}
|
||||
self.walk_sfx_cd_remaining = 0.;
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,6 +275,9 @@ impl IPlayer for LocalPlayer {
|
||||
|
||||
fn jump(&mut self) {
|
||||
if self.try_jump() {
|
||||
if let Some(effects) = &mut self.effects {
|
||||
effects.bind_mut().jump();
|
||||
}
|
||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
|
||||
match peer {
|
||||
PeerKind::Client(peer, addr) => peer.send_reliable(&addr, Jump(0)),
|
||||
@ -542,7 +545,7 @@ impl ICharacterBody3D for LocalPlayer {
|
||||
scoreboard.set_visible(Input::singleton().is_action_pressed("scoreboard"));
|
||||
}
|
||||
|
||||
if self.movement_dir.length_squared() > 0. {
|
||||
if self.movement_dir.length_squared() > 0. && self.base().is_on_floor() {
|
||||
if let Some(effects) = &mut self.effects {
|
||||
effects.bind_mut().walk();
|
||||
}
|
||||
@ -556,8 +559,11 @@ impl ICharacterBody3D for LocalPlayer {
|
||||
} else {
|
||||
(0., 0.)
|
||||
};
|
||||
let done_cd_percent =
|
||||
1. - (weapon.dyn_bind().get_remaining_cd() / weapon.dyn_bind().get_max_cd());
|
||||
let done_cd_percent = if weapon.dyn_bind().get_max_cd() > 0. {
|
||||
1. - (weapon.dyn_bind().get_remaining_cd() / weapon.dyn_bind().get_max_cd())
|
||||
} else {
|
||||
1.
|
||||
};
|
||||
let new_weapon_rot = weapon
|
||||
.get_rotation()
|
||||
.lerp(Vector3::ZERO, 0.03 * done_cd_percent as f32);
|
||||
@ -841,7 +847,11 @@ impl IPlayer for RemotePlayer {
|
||||
}
|
||||
|
||||
fn jump(&mut self) {
|
||||
self.try_jump();
|
||||
if self.try_jump() {
|
||||
if let Some(effects) = &mut self.effects {
|
||||
effects.bind_mut().jump();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_look_up(&self) -> f32 {
|
||||
@ -870,8 +880,8 @@ impl IPlayer for RemotePlayer {
|
||||
rid,
|
||||
self.player_id.unwrap_or(0),
|
||||
camera_origin.get_global_position(),
|
||||
camera_origin.get_basis().col_b(),
|
||||
to,
|
||||
camera_origin.get_basis().col_b(),
|
||||
deal_damage,
|
||||
)
|
||||
} else {
|
||||
@ -992,6 +1002,7 @@ impl ICharacterBody3D for RemotePlayer {
|
||||
}
|
||||
|
||||
if self.movement_dir.length_squared() > 0.
|
||||
&& self.base().is_on_floor()
|
||||
&& let Some(effects) = &mut self.effects
|
||||
{
|
||||
effects.bind_mut().walk();
|
||||
|
||||
@ -104,6 +104,7 @@ impl ChatBox {
|
||||
}
|
||||
|
||||
pub fn on_submit(&mut self, message: GString) {
|
||||
let message = message.to_string().trim().to_owned();
|
||||
if let Some(line_edit) = &mut self.line_edit {
|
||||
line_edit.clear();
|
||||
if self.in_game {
|
||||
@ -111,6 +112,9 @@ impl ChatBox {
|
||||
}
|
||||
}
|
||||
self.signals().on_closed().emit();
|
||||
if message.is_empty() {
|
||||
return;
|
||||
}
|
||||
if let Some(peer) = &mut NetworkManager::singleton().bind_mut().peer {
|
||||
match peer {
|
||||
PeerKind::Client(peer, socket_addr) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user