Make spawn protection time configurable
This commit is contained in:
parent
1393338839
commit
4b00adfc77
@ -836,7 +836,7 @@ impl Game {
|
||||
|
||||
if let Some(character) = &mut character {
|
||||
character.dyn_bind_mut().new_buff(Buff {
|
||||
time_remaining: 5.,
|
||||
time_remaining: self.opts.get_float(GameOption::SpawnProtection),
|
||||
kind: BuffKind::SpawnProtection,
|
||||
});
|
||||
|
||||
@ -906,7 +906,7 @@ impl Game {
|
||||
if let Some(player) = self.players.iter_mut().find(|p| p.id() == id) {
|
||||
if let Some(mut character) = player.character.clone() {
|
||||
character.dyn_bind_mut().new_buff(Buff {
|
||||
time_remaining: 5.,
|
||||
time_remaining: self.opts.get_float(GameOption::SpawnProtection),
|
||||
kind: BuffKind::SpawnProtection,
|
||||
});
|
||||
|
||||
|
||||
@ -15,6 +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::TelegrenadesAllowed,
|
||||
GameOptionValue::Boolean(true),
|
||||
@ -63,6 +64,8 @@ pub enum GameOption {
|
||||
TelegrenadesAllowed,
|
||||
/// How long in seconds does it take for a player to respawn
|
||||
RespawnTimer,
|
||||
/// How long in seconds is spawn protected
|
||||
SpawnProtection,
|
||||
}
|
||||
|
||||
impl ToString for GameOption {
|
||||
@ -74,6 +77,7 @@ impl ToString for GameOption {
|
||||
GameOption::GoalsNeededToWin => "Goals needed to win",
|
||||
GameOption::TelegrenadesAllowed => "Telegrenades allowed",
|
||||
GameOption::RespawnTimer => "Respawn Time (seconds)",
|
||||
GameOption::SpawnProtection => "Spawn Protection",
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user