diff --git a/rust/src/game/opts.rs b/rust/src/game/opts.rs index 743e71f..7eac06e 100644 --- a/rust/src/game/opts.rs +++ b/rust/src/game/opts.rs @@ -15,7 +15,7 @@ impl Default for GameOptions { opts.insert(GameOption::FriendlyFire, GameOptionValue::Boolean(true)); opts.insert(GameOption::GoalsNeededToWin, GameOptionValue::Number(5.)); opts.insert(GameOption::RespawnTimer, GameOptionValue::Number(5.)); - opts.insert(GameOption::SpawnProtection, GameOptionValue::Number(5.)); + opts.insert(GameOption::SpawnProtection, GameOptionValue::Number(3.)); opts.insert( GameOption::TelegrenadesAllowed, GameOptionValue::Boolean(true), diff --git a/rust/src/player/buffs.rs b/rust/src/player/buffs.rs index 1b3161e..caf3b98 100644 --- a/rust/src/player/buffs.rs +++ b/rust/src/player/buffs.rs @@ -45,6 +45,15 @@ impl Buffs { true } + pub fn can_shoot(&self) -> bool { + for buff in &self.buffs { + match buff.kind { + BuffKind::SpawnProtection => return false, + } + } + true + } + pub fn new_buff(&mut self, buff: Buff) { self.buffs.push(buff); } diff --git a/rust/src/player/local_player.rs b/rust/src/player/local_player.rs index 62856ea..028b8d4 100644 --- a/rust/src/player/local_player.rs +++ b/rust/src/player/local_player.rs @@ -203,7 +203,7 @@ impl IPlayer for LocalPlayer { } fn try_shoot(&mut self, to: Vector3, deal_damage: bool) -> bool { - if self.try_shoot_common(to, deal_damage) { + if self.buffs.can_shoot() && self.try_shoot_common(to, deal_damage) { if let Some(weapon) = &mut self.weapon { weapon.set_position(-Vector3::FORWARD); weapon.set_rotation(Vector3::RIGHT * 0.5); diff --git a/rust/src/player/remote_player.rs b/rust/src/player/remote_player.rs index cc37862..19a8d9f 100644 --- a/rust/src/player/remote_player.rs +++ b/rust/src/player/remote_player.rs @@ -148,7 +148,11 @@ impl IPlayer for RemotePlayer { } fn try_shoot(&mut self, to: Vector3, deal_damage: bool) -> bool { - self.try_shoot_common(to, deal_damage) + if self.buffs.can_shoot() { + self.try_shoot_common(to, deal_damage) + } else { + false + } } fn try_throw_telegrenade(&mut self, to: Vector3) -> bool {