Make /debug_column pick current location as default

This commit is contained in:
Snowram 2020-10-14 23:02:58 +02:00
parent febe79e602
commit 2b08e8b931

View File

@ -1561,18 +1561,29 @@ fn handle_debug_column(
fn handle_debug_column(
server: &mut Server,
client: EcsEntity,
_target: EcsEntity,
target: EcsEntity,
args: String,
action: &ChatCommand,
) {
let sim = server.world.sim();
let sampler = server.world.sample_columns();
let mut wpos = Vec2::new(0, 0);
if let Ok((x, y)) = scan_fmt!(&args, &action.arg_fmt(), i32, i32) {
let wpos = Vec2::new(x, y);
//match server.state.read_component_copied::<comp::Pos>(target)
wpos = Vec2::new(x, y);
}
/* let chunk_pos = wpos.map2(TerrainChunkSize::RECT_SIZE, |e, sz: u32| {
e / sz as i32
}); */
else {
match server.state.read_component_copied::<comp::Pos>(target) {
Some(pos) => wpos = pos.0.xy().map(|x| x as i32),
None => server.notify_client(
client,
ChatType::CommandError.server_msg(String::from("You have no position.")),
),
}
}
let msg_generator = || {
// let sim_chunk = sim.get(chunk_pos)?;
let alt = sim.get_interpolated(wpos, |chunk| chunk.alt)?;
@ -1630,12 +1641,6 @@ spawn_rate {:?} "#,
ChatType::CommandError.server_msg("Not a pregenerated chunk."),
);
}
} else {
server.notify_client(
client,
ChatType::CommandError.server_msg(action.help_string()),
);
}
}
fn find_target(