small changes

This commit is contained in:
Isse 2023-05-09 19:52:40 +02:00
parent bcc8c55b5e
commit 1617c180ef
3 changed files with 21 additions and 36 deletions

View File

@ -461,7 +461,7 @@ impl ServerChatCommand {
Float("x", 0.0, Required),
Float("y", 0.0, Required),
Float("z", 0.0, Required),
Boolean("Force from ship", "true".to_string(), Optional),
Boolean("Dismount from ship", "true".to_string(), Optional),
],
"Teleport to a position",
Some(Admin),
@ -506,7 +506,7 @@ impl ServerChatCommand {
Float("x", 0.0, Required),
Float("y", 0.0, Required),
Float("z", 0.0, Required),
Boolean("Force from ship", "true".to_string(), Optional),
Boolean("Dismount from ship", "true".to_string(), Optional),
],
"Offset your current position",
Some(Admin),
@ -641,7 +641,7 @@ impl ServerChatCommand {
ServerChatCommand::Site => cmd(
vec![
SiteName(Required),
Boolean("Force from ship", "true".to_string(), Optional),
Boolean("Dismount from ship", "true".to_string(), Optional),
],
"Teleport to a site",
Some(Moderator),
@ -688,7 +688,7 @@ impl ServerChatCommand {
ServerChatCommand::Tp => cmd(
vec![
PlayerName(Optional),
Boolean("Force from ship", "true".to_string(), Optional),
Boolean("Dismount from ship", "true".to_string(), Optional),
],
"Teleport to another player",
Some(Moderator),
@ -696,7 +696,7 @@ impl ServerChatCommand {
ServerChatCommand::RtsimTp => cmd(
vec![
Integer("npc index", 0, Required),
Boolean("Force from ship", "true".to_string(), Optional),
Boolean("Dismount from ship", "true".to_string(), Optional),
],
"Teleport to an rtsim npc",
Some(Moderator),

View File

@ -227,10 +227,10 @@ fn position_mut<T>(
server: &mut Server,
entity: EcsEntity,
descriptor: &str,
force_from_volume: Option<bool>,
dismount_volume: Option<bool>,
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
) -> CmdResult<T> {
let entity = if force_from_volume.unwrap_or(true) {
let entity = if dismount_volume.unwrap_or(true) {
server
.state
.ecs()
@ -855,10 +855,9 @@ fn handle_jump(
args: Vec<String>,
action: &ServerChatCommand,
) -> CmdResult<()> {
if let (Some(x), Some(y), Some(z), force_from_volume) =
parse_cmd_args!(args, f32, f32, f32, bool)
if let (Some(x), Some(y), Some(z), dismount_volume) = parse_cmd_args!(args, f32, f32, f32, bool)
{
position_mut(server, target, "target", force_from_volume, |current_pos| {
position_mut(server, target, "target", dismount_volume, |current_pos| {
current_pos.0 += Vec3::new(x, y, z)
})
} else {
@ -873,10 +872,9 @@ fn handle_goto(
args: Vec<String>,
action: &ServerChatCommand,
) -> CmdResult<()> {
if let (Some(x), Some(y), Some(z), force_from_volume) =
parse_cmd_args!(args, f32, f32, f32, bool)
if let (Some(x), Some(y), Some(z), dismount_volume) = parse_cmd_args!(args, f32, f32, f32, bool)
{
position_mut(server, target, "target", force_from_volume, |current_pos| {
position_mut(server, target, "target", dismount_volume, |current_pos| {
current_pos.0 = Vec3::new(x, y, z)
})
} else {
@ -894,7 +892,7 @@ fn handle_site(
action: &ServerChatCommand,
) -> CmdResult<()> {
#[cfg(feature = "worldgen")]
if let (Some(dest_name), force_from_volume) = parse_cmd_args!(args, String, bool) {
if let (Some(dest_name), dismount_volume) = parse_cmd_args!(args, String, bool) {
let site = server
.world
.civs()
@ -911,7 +909,7 @@ fn handle_site(
false,
);
position_mut(server, target, "target", force_from_volume, |current_pos| {
position_mut(server, target, "target", dismount_volume, |current_pos| {
current_pos.0 = site_pos
})
} else {
@ -1235,7 +1233,7 @@ fn handle_tp(
args: Vec<String>,
action: &ServerChatCommand,
) -> CmdResult<()> {
let (player, force_from_volume) = parse_cmd_args!(args, String, bool);
let (player, dismount_volume) = parse_cmd_args!(args, String, bool);
let player = if let Some(alias) = player {
find_alias(server.state.ecs(), &alias)?.0
} else if client != target {
@ -1244,7 +1242,7 @@ fn handle_tp(
return Err(action.help_string());
};
let player_pos = position(server, player, "player")?;
position_mut(server, target, "target", force_from_volume, |target_pos| {
position_mut(server, target, "target", dismount_volume, |target_pos| {
*target_pos = player_pos
})
}
@ -1257,7 +1255,7 @@ fn handle_rtsim_tp(
action: &ServerChatCommand,
) -> CmdResult<()> {
use crate::rtsim::RtSim;
let (npc_index, force_from_volume) = parse_cmd_args!(args, u32, bool);
let (npc_index, dismount_volume) = parse_cmd_args!(args, u32, bool);
let pos = if let Some(id) = npc_index {
// TODO: Take some other identifier than an integer to this command.
server
@ -1274,7 +1272,7 @@ fn handle_rtsim_tp(
} else {
return Err(action.help_string());
};
position_mut(server, target, "target", force_from_volume, |target_pos| {
position_mut(server, target, "target", dismount_volume, |target_pos| {
target_pos.0 = pos;
})
}

View File

@ -56,11 +56,7 @@ where
let draw_delta = lower_bound;
let get_light = |vol: &mut V, pos: Vec3<i32>| {
if vol.get(pos).map_or(true, |vox| !vox.is_filled()) {
1.0
} else {
0.0
}
vol.get(pos).map_or(true, |vox| !vox.is_filled()) as i32 as f32
};
let get_glow = |_vol: &mut V, _pos: Vec3<i32>| 0.0;
let get_opacity =
@ -302,13 +298,8 @@ where
let greedy_size_cross = greedy_size;
let draw_delta = Vec3::new(1, 1, 1);
let get_light = move |flat: &mut _, pos: Vec3<i32>| {
if !flat_get(flat, pos).is_filled() {
1.0
} else {
0.0
}
};
let get_light =
move |flat: &mut _, pos: Vec3<i32>| !flat_get(flat, pos).is_filled() as i32 as f32;
let get_glow = |_flat: &mut _, _pos: Vec3<i32>| 0.0;
let get_color = move |flat: &mut _, pos: Vec3<i32>| {
flat_get(flat, pos).get_color().unwrap_or_else(Rgb::zero)
@ -390,11 +381,7 @@ where
let draw_delta = lower_bound;
let get_light = |vol: &mut V, pos: Vec3<i32>| {
if vol.get(pos).map_or(true, |vox| !vox.is_filled()) {
1.0
} else {
0.0
}
vol.get(pos).map_or(true, |vox| !vox.is_filled()) as i32 as f32
};
let get_glow = |_vol: &mut V, _pos: Vec3<i32>| 0.0;
let get_color = |vol: &mut V, pos: Vec3<i32>| {