From e6f384fc11eef11c4d0f6b38af2022e6413986a7 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Wed, 7 Aug 2019 18:18:32 +0100 Subject: [PATCH] Added default explosion radius --- server/src/cmd.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 3915d7abdf..e5d9e8bbc5 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -677,18 +677,18 @@ fn handle_lantern(server: &mut Server, entity: EcsEntity, args: String, action: } fn handle_explosion(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) { - if let Ok(radius) = scan_fmt!(&args, action.arg_fmt, f32) { - match server.state.read_component_cloned::(entity) { - Some(pos) => server - .state - .ecs() - .read_resource::() - .emit(GameEvent::Explosion { pos: pos.0, radius }), - None => server.clients.notify( - entity, - ServerMsg::private(String::from("You have no position!")), - ), - } + let radius = scan_fmt!(&args, action.arg_fmt, f32).unwrap_or(8.0); + + match server.state.read_component_cloned::(entity) { + Some(pos) => server + .state + .ecs() + .read_resource::() + .emit(GameEvent::Explosion { pos: pos.0, radius }), + None => server.clients.notify( + entity, + ServerMsg::private(String::from("You have no position!")), + ), } }