Add chunk reload command (admin only)

This commit is contained in:
James Melkonian 2022-03-19 08:43:38 +00:00 committed by Ben Wallis
parent aa244b23c4
commit 8c06dc9a5c
3 changed files with 21 additions and 0 deletions

View File

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New rocks
- Weapon trails
- Hostile agent will now abort pursuing their target based on multiple metrics
- Admin command to reload all chunks on the server
### Changed

View File

@ -86,6 +86,7 @@ pub enum ChatCommand {
PermitBuild,
Players,
Region,
ReloadChunks,
RemoveLights,
RevokeBuild,
RevokeBuildAll,
@ -531,6 +532,11 @@ impl ChatCommand {
Some(Admin),
),
ChatCommand::Players => cmd(vec![], "Lists players currently online", None),
ChatCommand::ReloadChunks => cmd(
vec![],
"Reloads all chunks loaded on the server",
Some(Admin),
),
ChatCommand::RemoveLights => cmd(
vec![Float("radius", 20.0, Optional)],
"Removes all lights spawned by players",
@ -715,6 +721,7 @@ impl ChatCommand {
ChatCommand::PermitBuild => "permit_build",
ChatCommand::Players => "players",
ChatCommand::Region => "region",
ChatCommand::ReloadChunks => "reload_chunks",
ChatCommand::RemoveLights => "remove_lights",
ChatCommand::RevokeBuild => "revoke_build",
ChatCommand::RevokeBuildAll => "revoke_build_all",

View File

@ -161,6 +161,7 @@ fn do_command(
ChatCommand::PermitBuild => handle_permit_build,
ChatCommand::Players => handle_players,
ChatCommand::Region => handle_region,
ChatCommand::ReloadChunks => handle_reload_chunks,
ChatCommand::RemoveLights => handle_remove_lights,
ChatCommand::RevokeBuild => handle_revoke_build,
ChatCommand::RevokeBuildAll => handle_revoke_build_all,
@ -2968,6 +2969,18 @@ fn parse_skill_tree(skill_tree: &str) -> CmdResult<comp::skillset::SkillGroupKin
}
}
fn handle_reload_chunks(
server: &mut Server,
_client: EcsEntity,
_target: EcsEntity,
_args: Vec<String>,
_action: &ChatCommand,
) -> CmdResult<()> {
server.state.clear_terrain();
Ok(())
}
fn handle_remove_lights(
server: &mut Server,
client: EcsEntity,