Added default explosion radius

This commit is contained in:
Joshua Barretto 2019-08-07 18:18:32 +01:00
parent 5b62531da3
commit e6f384fc11

View File

@ -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::<comp::Pos>(entity) {
Some(pos) => server
.state
.ecs()
.read_resource::<EventBus>()
.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::<comp::Pos>(entity) {
Some(pos) => server
.state
.ecs()
.read_resource::<EventBus>()
.emit(GameEvent::Explosion { pos: pos.0, radius }),
None => server.clients.notify(
entity,
ServerMsg::private(String::from("You have no position!")),
),
}
}