mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
small changes
This commit is contained in:
parent
bcc8c55b5e
commit
1617c180ef
@ -461,7 +461,7 @@ impl ServerChatCommand {
|
|||||||
Float("x", 0.0, Required),
|
Float("x", 0.0, Required),
|
||||||
Float("y", 0.0, Required),
|
Float("y", 0.0, Required),
|
||||||
Float("z", 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",
|
"Teleport to a position",
|
||||||
Some(Admin),
|
Some(Admin),
|
||||||
@ -506,7 +506,7 @@ impl ServerChatCommand {
|
|||||||
Float("x", 0.0, Required),
|
Float("x", 0.0, Required),
|
||||||
Float("y", 0.0, Required),
|
Float("y", 0.0, Required),
|
||||||
Float("z", 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",
|
"Offset your current position",
|
||||||
Some(Admin),
|
Some(Admin),
|
||||||
@ -641,7 +641,7 @@ impl ServerChatCommand {
|
|||||||
ServerChatCommand::Site => cmd(
|
ServerChatCommand::Site => cmd(
|
||||||
vec![
|
vec![
|
||||||
SiteName(Required),
|
SiteName(Required),
|
||||||
Boolean("Force from ship", "true".to_string(), Optional),
|
Boolean("Dismount from ship", "true".to_string(), Optional),
|
||||||
],
|
],
|
||||||
"Teleport to a site",
|
"Teleport to a site",
|
||||||
Some(Moderator),
|
Some(Moderator),
|
||||||
@ -688,7 +688,7 @@ impl ServerChatCommand {
|
|||||||
ServerChatCommand::Tp => cmd(
|
ServerChatCommand::Tp => cmd(
|
||||||
vec![
|
vec![
|
||||||
PlayerName(Optional),
|
PlayerName(Optional),
|
||||||
Boolean("Force from ship", "true".to_string(), Optional),
|
Boolean("Dismount from ship", "true".to_string(), Optional),
|
||||||
],
|
],
|
||||||
"Teleport to another player",
|
"Teleport to another player",
|
||||||
Some(Moderator),
|
Some(Moderator),
|
||||||
@ -696,7 +696,7 @@ impl ServerChatCommand {
|
|||||||
ServerChatCommand::RtsimTp => cmd(
|
ServerChatCommand::RtsimTp => cmd(
|
||||||
vec![
|
vec![
|
||||||
Integer("npc index", 0, Required),
|
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",
|
"Teleport to an rtsim npc",
|
||||||
Some(Moderator),
|
Some(Moderator),
|
||||||
|
@ -227,10 +227,10 @@ fn position_mut<T>(
|
|||||||
server: &mut Server,
|
server: &mut Server,
|
||||||
entity: EcsEntity,
|
entity: EcsEntity,
|
||||||
descriptor: &str,
|
descriptor: &str,
|
||||||
force_from_volume: Option<bool>,
|
dismount_volume: Option<bool>,
|
||||||
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
f: impl for<'a> FnOnce(&'a mut comp::Pos) -> T,
|
||||||
) -> CmdResult<T> {
|
) -> CmdResult<T> {
|
||||||
let entity = if force_from_volume.unwrap_or(true) {
|
let entity = if dismount_volume.unwrap_or(true) {
|
||||||
server
|
server
|
||||||
.state
|
.state
|
||||||
.ecs()
|
.ecs()
|
||||||
@ -855,10 +855,9 @@ fn handle_jump(
|
|||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
action: &ServerChatCommand,
|
action: &ServerChatCommand,
|
||||||
) -> CmdResult<()> {
|
) -> CmdResult<()> {
|
||||||
if let (Some(x), Some(y), Some(z), force_from_volume) =
|
if let (Some(x), Some(y), Some(z), dismount_volume) = parse_cmd_args!(args, f32, f32, f32, bool)
|
||||||
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)
|
current_pos.0 += Vec3::new(x, y, z)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -873,10 +872,9 @@ fn handle_goto(
|
|||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
action: &ServerChatCommand,
|
action: &ServerChatCommand,
|
||||||
) -> CmdResult<()> {
|
) -> CmdResult<()> {
|
||||||
if let (Some(x), Some(y), Some(z), force_from_volume) =
|
if let (Some(x), Some(y), Some(z), dismount_volume) = parse_cmd_args!(args, f32, f32, f32, bool)
|
||||||
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)
|
current_pos.0 = Vec3::new(x, y, z)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -894,7 +892,7 @@ fn handle_site(
|
|||||||
action: &ServerChatCommand,
|
action: &ServerChatCommand,
|
||||||
) -> CmdResult<()> {
|
) -> CmdResult<()> {
|
||||||
#[cfg(feature = "worldgen")]
|
#[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
|
let site = server
|
||||||
.world
|
.world
|
||||||
.civs()
|
.civs()
|
||||||
@ -911,7 +909,7 @@ fn handle_site(
|
|||||||
false,
|
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
|
current_pos.0 = site_pos
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -1235,7 +1233,7 @@ fn handle_tp(
|
|||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
action: &ServerChatCommand,
|
action: &ServerChatCommand,
|
||||||
) -> CmdResult<()> {
|
) -> 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 {
|
let player = if let Some(alias) = player {
|
||||||
find_alias(server.state.ecs(), &alias)?.0
|
find_alias(server.state.ecs(), &alias)?.0
|
||||||
} else if client != target {
|
} else if client != target {
|
||||||
@ -1244,7 +1242,7 @@ fn handle_tp(
|
|||||||
return Err(action.help_string());
|
return Err(action.help_string());
|
||||||
};
|
};
|
||||||
let player_pos = position(server, player, "player")?;
|
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
|
*target_pos = player_pos
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1257,7 +1255,7 @@ fn handle_rtsim_tp(
|
|||||||
action: &ServerChatCommand,
|
action: &ServerChatCommand,
|
||||||
) -> CmdResult<()> {
|
) -> CmdResult<()> {
|
||||||
use crate::rtsim::RtSim;
|
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 {
|
let pos = if let Some(id) = npc_index {
|
||||||
// TODO: Take some other identifier than an integer to this command.
|
// TODO: Take some other identifier than an integer to this command.
|
||||||
server
|
server
|
||||||
@ -1274,7 +1272,7 @@ fn handle_rtsim_tp(
|
|||||||
} else {
|
} else {
|
||||||
return Err(action.help_string());
|
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;
|
target_pos.0 = pos;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,7 @@ where
|
|||||||
let draw_delta = lower_bound;
|
let draw_delta = lower_bound;
|
||||||
|
|
||||||
let get_light = |vol: &mut V, pos: Vec3<i32>| {
|
let get_light = |vol: &mut V, pos: Vec3<i32>| {
|
||||||
if vol.get(pos).map_or(true, |vox| !vox.is_filled()) {
|
vol.get(pos).map_or(true, |vox| !vox.is_filled()) as i32 as f32
|
||||||
1.0
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let get_glow = |_vol: &mut V, _pos: Vec3<i32>| 0.0;
|
let get_glow = |_vol: &mut V, _pos: Vec3<i32>| 0.0;
|
||||||
let get_opacity =
|
let get_opacity =
|
||||||
@ -302,13 +298,8 @@ where
|
|||||||
let greedy_size_cross = greedy_size;
|
let greedy_size_cross = greedy_size;
|
||||||
let draw_delta = Vec3::new(1, 1, 1);
|
let draw_delta = Vec3::new(1, 1, 1);
|
||||||
|
|
||||||
let get_light = move |flat: &mut _, pos: Vec3<i32>| {
|
let get_light =
|
||||||
if !flat_get(flat, pos).is_filled() {
|
move |flat: &mut _, pos: Vec3<i32>| !flat_get(flat, pos).is_filled() as i32 as f32;
|
||||||
1.0
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let get_glow = |_flat: &mut _, _pos: Vec3<i32>| 0.0;
|
let get_glow = |_flat: &mut _, _pos: Vec3<i32>| 0.0;
|
||||||
let get_color = move |flat: &mut _, pos: Vec3<i32>| {
|
let get_color = move |flat: &mut _, pos: Vec3<i32>| {
|
||||||
flat_get(flat, pos).get_color().unwrap_or_else(Rgb::zero)
|
flat_get(flat, pos).get_color().unwrap_or_else(Rgb::zero)
|
||||||
@ -390,11 +381,7 @@ where
|
|||||||
let draw_delta = lower_bound;
|
let draw_delta = lower_bound;
|
||||||
|
|
||||||
let get_light = |vol: &mut V, pos: Vec3<i32>| {
|
let get_light = |vol: &mut V, pos: Vec3<i32>| {
|
||||||
if vol.get(pos).map_or(true, |vox| !vox.is_filled()) {
|
vol.get(pos).map_or(true, |vox| !vox.is_filled()) as i32 as f32
|
||||||
1.0
|
|
||||||
} else {
|
|
||||||
0.0
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
let get_glow = |_vol: &mut V, _pos: Vec3<i32>| 0.0;
|
let get_glow = |_vol: &mut V, _pos: Vec3<i32>| 0.0;
|
||||||
let get_color = |vol: &mut V, pos: Vec3<i32>| {
|
let get_color = |vol: &mut V, pos: Vec3<i32>| {
|
||||||
|
Loading…
Reference in New Issue
Block a user