mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add /body command that allows you to switch body
This commit is contained in:
parent
74e8dbf757
commit
a371aad05e
@ -240,6 +240,7 @@ pub enum ServerChatCommand {
|
|||||||
Ban,
|
Ban,
|
||||||
BattleMode,
|
BattleMode,
|
||||||
BattleModeForce,
|
BattleModeForce,
|
||||||
|
Body,
|
||||||
Build,
|
Build,
|
||||||
BuildAreaAdd,
|
BuildAreaAdd,
|
||||||
BuildAreaList,
|
BuildAreaList,
|
||||||
@ -365,6 +366,11 @@ impl ServerChatCommand {
|
|||||||
None,
|
None,
|
||||||
|
|
||||||
),
|
),
|
||||||
|
ServerChatCommand::Body => cmd(
|
||||||
|
vec![Enum("body", ENTITIES.clone(), Required)],
|
||||||
|
"Change your body to different species",
|
||||||
|
Some(Admin),
|
||||||
|
),
|
||||||
ServerChatCommand::BattleModeForce => cmd(
|
ServerChatCommand::BattleModeForce => cmd(
|
||||||
vec![Enum(
|
vec![Enum(
|
||||||
"battle mode",
|
"battle mode",
|
||||||
@ -720,6 +726,7 @@ impl ServerChatCommand {
|
|||||||
ServerChatCommand::Ban => "ban",
|
ServerChatCommand::Ban => "ban",
|
||||||
ServerChatCommand::BattleMode => "battlemode",
|
ServerChatCommand::BattleMode => "battlemode",
|
||||||
ServerChatCommand::BattleModeForce => "battlemode_force",
|
ServerChatCommand::BattleModeForce => "battlemode_force",
|
||||||
|
ServerChatCommand::Body => "body",
|
||||||
ServerChatCommand::Build => "build",
|
ServerChatCommand::Build => "build",
|
||||||
ServerChatCommand::BuildAreaAdd => "build_area_add",
|
ServerChatCommand::BuildAreaAdd => "build_area_add",
|
||||||
ServerChatCommand::BuildAreaList => "build_area_list",
|
ServerChatCommand::BuildAreaList => "build_area_list",
|
||||||
|
@ -129,6 +129,7 @@ fn do_command(
|
|||||||
ServerChatCommand::Ban => handle_ban,
|
ServerChatCommand::Ban => handle_ban,
|
||||||
ServerChatCommand::BattleMode => handle_battlemode,
|
ServerChatCommand::BattleMode => handle_battlemode,
|
||||||
ServerChatCommand::BattleModeForce => handle_battlemode_force,
|
ServerChatCommand::BattleModeForce => handle_battlemode_force,
|
||||||
|
ServerChatCommand::Body => handle_body,
|
||||||
ServerChatCommand::Build => handle_build,
|
ServerChatCommand::Build => handle_build,
|
||||||
ServerChatCommand::BuildAreaAdd => handle_build_area_add,
|
ServerChatCommand::BuildAreaAdd => handle_build_area_add,
|
||||||
ServerChatCommand::BuildAreaList => handle_build_area_list,
|
ServerChatCommand::BuildAreaList => handle_build_area_list,
|
||||||
@ -3704,3 +3705,23 @@ fn handle_lightning(
|
|||||||
.emit_now(Outcome::Lightning { pos });
|
.emit_now(Outcome::Lightning { pos });
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn handle_body(
|
||||||
|
server: &mut Server,
|
||||||
|
_client: EcsEntity,
|
||||||
|
target: EcsEntity,
|
||||||
|
args: Vec<String>,
|
||||||
|
action: &ServerChatCommand,
|
||||||
|
) -> CmdResult<()> {
|
||||||
|
if let Some(npc::NpcBody(_id, mut body)) = parse_cmd_args!(args, npc::NpcBody) {
|
||||||
|
let body = body();
|
||||||
|
let ecs = &server.state.ecs();
|
||||||
|
let mut bodies = ecs.write_storage::<comp::Body>();
|
||||||
|
if let Some(mut target_body) = bodies.get_mut(target) {
|
||||||
|
*target_body = body;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(action.help_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user