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