mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
New Command: "kit" + Removed Command: "debug"
Update CHANGELOG.md Update CHANGELOG.md
This commit is contained in:
parent
9289feee23
commit
0692562533
@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Stun resilience stat display
|
- Stun resilience stat display
|
||||||
- Villagers and guards now spawn with potions, and know how to use them.
|
- Villagers and guards now spawn with potions, and know how to use them.
|
||||||
- Combat music in dungeons when within range of enemies.
|
- Combat music in dungeons when within range of enemies.
|
||||||
|
- New Command: "kit", place a set of items into your inventory
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
@ -51,6 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
- Removed command: "debug", use "/kit debug" instead
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Server kicks old client when a user is trying to log in again (often the case when a user's original connection gets dropped)
|
- Server kicks old client when a user is trying to log in again (often the case when a user's original connection gets dropped)
|
||||||
|
@ -10,7 +10,7 @@ ItemDef(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
quality: Artifact,
|
quality: Debug,
|
||||||
tags: [],
|
tags: [],
|
||||||
slots: 900,
|
slots: 900,
|
||||||
)
|
)
|
||||||
|
29
assets/server/manifests/kits.ron
Normal file
29
assets/server/manifests/kits.ron
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
({
|
||||||
|
"debug": [
|
||||||
|
"common.items.debug.admin_back",
|
||||||
|
"common.items.debug.admin_black_hole",
|
||||||
|
"common.items.debug.admin_stick",
|
||||||
|
"common.items.debug.admin_sword",
|
||||||
|
"common.items.debug.admin",
|
||||||
|
"common.items.debug.cultist_belt",
|
||||||
|
"common.items.debug.cultist_boots",
|
||||||
|
"common.items.debug.cultist_chest_blue",
|
||||||
|
"common.items.debug.cultist_hands_blue",
|
||||||
|
"common.items.debug.cultist_legs_blue",
|
||||||
|
"common.items.debug.cultist_shoulder_blue",
|
||||||
|
"common.items.debug.dungeon_purple",
|
||||||
|
],
|
||||||
|
"cultist": [
|
||||||
|
"common.items.armor.cultist.chest",
|
||||||
|
"common.items.armor.cultist.pants",
|
||||||
|
"common.items.armor.cultist.hand",
|
||||||
|
"common.items.armor.cultist.foot",
|
||||||
|
"common.items.armor.cultist.shoulder",
|
||||||
|
"common.items.armor.cultist.belt",
|
||||||
|
"common.items.weapons.hammer.cultist_purp_2h-0",
|
||||||
|
"common.items.weapons.staff.cultist_staff",
|
||||||
|
"common.items.weapons.sword.cultist",
|
||||||
|
"common.items.weapons.bow.velorite",
|
||||||
|
"common.items.weapons.axe.malachite_axe-0",
|
||||||
|
]
|
||||||
|
})
|
@ -44,7 +44,6 @@ pub enum ChatCommand {
|
|||||||
BuildAreaList,
|
BuildAreaList,
|
||||||
BuildAreaRemove,
|
BuildAreaRemove,
|
||||||
Campfire,
|
Campfire,
|
||||||
Debug,
|
|
||||||
DebugColumn,
|
DebugColumn,
|
||||||
DropAll,
|
DropAll,
|
||||||
Dummy,
|
Dummy,
|
||||||
@ -65,6 +64,7 @@ pub enum ChatCommand {
|
|||||||
Kick,
|
Kick,
|
||||||
Kill,
|
Kill,
|
||||||
KillNpcs,
|
KillNpcs,
|
||||||
|
Kit,
|
||||||
Lantern,
|
Lantern,
|
||||||
Light,
|
Light,
|
||||||
MakeBlock,
|
MakeBlock,
|
||||||
@ -105,7 +105,6 @@ pub static CHAT_COMMANDS: &[ChatCommand] = &[
|
|||||||
ChatCommand::BuildAreaList,
|
ChatCommand::BuildAreaList,
|
||||||
ChatCommand::BuildAreaRemove,
|
ChatCommand::BuildAreaRemove,
|
||||||
ChatCommand::Campfire,
|
ChatCommand::Campfire,
|
||||||
ChatCommand::Debug,
|
|
||||||
ChatCommand::DebugColumn,
|
ChatCommand::DebugColumn,
|
||||||
ChatCommand::DropAll,
|
ChatCommand::DropAll,
|
||||||
ChatCommand::Dummy,
|
ChatCommand::Dummy,
|
||||||
@ -126,6 +125,7 @@ pub static CHAT_COMMANDS: &[ChatCommand] = &[
|
|||||||
ChatCommand::Kick,
|
ChatCommand::Kick,
|
||||||
ChatCommand::Kill,
|
ChatCommand::Kill,
|
||||||
ChatCommand::KillNpcs,
|
ChatCommand::KillNpcs,
|
||||||
|
ChatCommand::Kit,
|
||||||
ChatCommand::Lantern,
|
ChatCommand::Lantern,
|
||||||
ChatCommand::Light,
|
ChatCommand::Light,
|
||||||
ChatCommand::MakeBlock,
|
ChatCommand::MakeBlock,
|
||||||
@ -270,7 +270,6 @@ impl ChatCommand {
|
|||||||
Admin,
|
Admin,
|
||||||
),
|
),
|
||||||
ChatCommand::Campfire => cmd(vec![], "Spawns a campfire", Admin),
|
ChatCommand::Campfire => cmd(vec![], "Spawns a campfire", Admin),
|
||||||
ChatCommand::Debug => cmd(vec![], "Place all debug items into your pack.", Admin),
|
|
||||||
ChatCommand::DebugColumn => cmd(
|
ChatCommand::DebugColumn => cmd(
|
||||||
vec![Integer("x", 15000, Required), Integer("y", 15000, Required)],
|
vec![Integer("x", 15000, Required), Integer("y", 15000, Required)],
|
||||||
"Prints some debug information about a column",
|
"Prints some debug information about a column",
|
||||||
@ -358,6 +357,11 @@ impl ChatCommand {
|
|||||||
),
|
),
|
||||||
ChatCommand::Kill => cmd(vec![], "Kill yourself", NoAdmin),
|
ChatCommand::Kill => cmd(vec![], "Kill yourself", NoAdmin),
|
||||||
ChatCommand::KillNpcs => cmd(vec![], "Kill the NPCs", Admin),
|
ChatCommand::KillNpcs => cmd(vec![], "Kill the NPCs", Admin),
|
||||||
|
ChatCommand::Kit => cmd(
|
||||||
|
vec![Any("kit_name", Required)],
|
||||||
|
"Place a set of items into your inventory.",
|
||||||
|
Admin,
|
||||||
|
),
|
||||||
ChatCommand::Lantern => cmd(
|
ChatCommand::Lantern => cmd(
|
||||||
vec![
|
vec![
|
||||||
Float("strength", 5.0, Required),
|
Float("strength", 5.0, Required),
|
||||||
@ -515,7 +519,6 @@ impl ChatCommand {
|
|||||||
ChatCommand::BuildAreaList => "build_area_list",
|
ChatCommand::BuildAreaList => "build_area_list",
|
||||||
ChatCommand::BuildAreaRemove => "build_area_remove",
|
ChatCommand::BuildAreaRemove => "build_area_remove",
|
||||||
ChatCommand::Campfire => "campfire",
|
ChatCommand::Campfire => "campfire",
|
||||||
ChatCommand::Debug => "debug",
|
|
||||||
ChatCommand::DebugColumn => "debug_column",
|
ChatCommand::DebugColumn => "debug_column",
|
||||||
ChatCommand::DropAll => "dropall",
|
ChatCommand::DropAll => "dropall",
|
||||||
ChatCommand::Dummy => "dummy",
|
ChatCommand::Dummy => "dummy",
|
||||||
@ -535,6 +538,7 @@ impl ChatCommand {
|
|||||||
ChatCommand::Jump => "jump",
|
ChatCommand::Jump => "jump",
|
||||||
ChatCommand::Kick => "kick",
|
ChatCommand::Kick => "kick",
|
||||||
ChatCommand::Kill => "kill",
|
ChatCommand::Kill => "kill",
|
||||||
|
ChatCommand::Kit => "kit",
|
||||||
ChatCommand::KillNpcs => "kill_npcs",
|
ChatCommand::KillNpcs => "kill_npcs",
|
||||||
ChatCommand::Lantern => "lantern",
|
ChatCommand::Lantern => "lantern",
|
||||||
ChatCommand::Light => "light",
|
ChatCommand::Light => "light",
|
||||||
|
@ -6,9 +6,11 @@ use crate::{
|
|||||||
settings::{BanRecord, EditableSetting},
|
settings::{BanRecord, EditableSetting},
|
||||||
Server, SpawnPoint, StateExt,
|
Server, SpawnPoint, StateExt,
|
||||||
};
|
};
|
||||||
|
use assets::AssetExt;
|
||||||
use authc::Uuid;
|
use authc::Uuid;
|
||||||
use chrono::{NaiveTime, Timelike};
|
use chrono::{NaiveTime, Timelike};
|
||||||
use common::{
|
use common::{
|
||||||
|
assets,
|
||||||
cmd::{ChatCommand, CHAT_COMMANDS, CHAT_SHORTCUTS},
|
cmd::{ChatCommand, CHAT_COMMANDS, CHAT_SHORTCUTS},
|
||||||
comp::{
|
comp::{
|
||||||
self,
|
self,
|
||||||
@ -36,7 +38,10 @@ use common_sys::state::{BuildAreaError, BuildAreas};
|
|||||||
use core::{convert::TryFrom, ops::Not, time::Duration};
|
use core::{convert::TryFrom, ops::Not, time::Duration};
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Builder, Entity as EcsEntity, Join, WorldExt};
|
use specs::{Builder, Entity as EcsEntity, Join, WorldExt};
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use world::util::Sampler;
|
use world::util::Sampler;
|
||||||
|
|
||||||
@ -98,7 +103,6 @@ fn get_handler(cmd: &ChatCommand) -> CommandHandler {
|
|||||||
ChatCommand::BuildAreaList => handle_build_area_list,
|
ChatCommand::BuildAreaList => handle_build_area_list,
|
||||||
ChatCommand::BuildAreaRemove => handle_build_area_remove,
|
ChatCommand::BuildAreaRemove => handle_build_area_remove,
|
||||||
ChatCommand::Campfire => handle_spawn_campfire,
|
ChatCommand::Campfire => handle_spawn_campfire,
|
||||||
ChatCommand::Debug => handle_debug,
|
|
||||||
ChatCommand::DebugColumn => handle_debug_column,
|
ChatCommand::DebugColumn => handle_debug_column,
|
||||||
ChatCommand::DropAll => handle_drop_all,
|
ChatCommand::DropAll => handle_drop_all,
|
||||||
ChatCommand::Dummy => handle_spawn_training_dummy,
|
ChatCommand::Dummy => handle_spawn_training_dummy,
|
||||||
@ -119,6 +123,7 @@ fn get_handler(cmd: &ChatCommand) -> CommandHandler {
|
|||||||
ChatCommand::Kick => handle_kick,
|
ChatCommand::Kick => handle_kick,
|
||||||
ChatCommand::Kill => handle_kill,
|
ChatCommand::Kill => handle_kill,
|
||||||
ChatCommand::KillNpcs => handle_kill_npcs,
|
ChatCommand::KillNpcs => handle_kill_npcs,
|
||||||
|
ChatCommand::Kit => handle_kit,
|
||||||
ChatCommand::Lantern => handle_lantern,
|
ChatCommand::Lantern => handle_lantern,
|
||||||
ChatCommand::Light => handle_light,
|
ChatCommand::Light => handle_light,
|
||||||
ChatCommand::MakeBlock => handle_make_block,
|
ChatCommand::MakeBlock => handle_make_block,
|
||||||
@ -1397,9 +1402,60 @@ fn handle_kill_npcs(
|
|||||||
client,
|
client,
|
||||||
ServerGeneral::server_msg(ChatType::CommandInfo, text),
|
ServerGeneral::server_msg(ChatType::CommandInfo, text),
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
|
struct KitManifest(HashMap<String, Vec<String>>);
|
||||||
|
impl assets::Asset for KitManifest {
|
||||||
|
type Loader = assets::RonLoader;
|
||||||
|
|
||||||
|
const EXTENSION: &'static str = "ron";
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_kit(
|
||||||
|
server: &mut Server,
|
||||||
|
_client: EcsEntity,
|
||||||
|
target: EcsEntity,
|
||||||
|
args: String,
|
||||||
|
action: &ChatCommand,
|
||||||
|
) -> CmdResult<()> {
|
||||||
|
let kit_name = scan_fmt!(&args, &action.arg_fmt(), String);
|
||||||
|
if let Ok(name) = kit_name {
|
||||||
|
if let Ok(kits) = KitManifest::load("server.manifests.kits") {
|
||||||
|
let kits = kits.read();
|
||||||
|
if let Some(kit) = kits.0.get(&name) {
|
||||||
|
for item_id in kit.iter() {
|
||||||
|
if let Ok(item) = comp::Item::new_from_asset(item_id) {
|
||||||
|
server
|
||||||
|
.state()
|
||||||
|
.ecs()
|
||||||
|
.write_storage::<comp::Inventory>()
|
||||||
|
.get_mut(target)
|
||||||
|
.map(|mut inv| inv.push(item));
|
||||||
|
let _ = server
|
||||||
|
.state
|
||||||
|
.ecs()
|
||||||
|
.write_storage::<comp::InventoryUpdate>()
|
||||||
|
.insert(
|
||||||
|
target,
|
||||||
|
comp::InventoryUpdate::new(comp::InventoryUpdateEvent::Debug),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(format!("Kit '{}' not found", name))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Err("Could not load manifest file 'server.manifests.kits'".to_string())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Err(action.help_string())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::float_cmp)] // TODO: Pending review in #587
|
#[allow(clippy::float_cmp)] // TODO: Pending review in #587
|
||||||
#[allow(clippy::needless_return)] // TODO: Pending review in #587
|
#[allow(clippy::needless_return)] // TODO: Pending review in #587
|
||||||
#[allow(clippy::useless_format)] // TODO: Pending review in #587
|
#[allow(clippy::useless_format)] // TODO: Pending review in #587
|
||||||
@ -2112,35 +2168,6 @@ fn parse_skill_tree(skill_tree: &str) -> CmdResult<comp::skills::SkillGroupKind>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_debug(
|
|
||||||
server: &mut Server,
|
|
||||||
_client: EcsEntity,
|
|
||||||
target: EcsEntity,
|
|
||||||
_args: String,
|
|
||||||
_action: &ChatCommand,
|
|
||||||
) -> CmdResult<()> {
|
|
||||||
if let Ok(items) = comp::Item::new_from_asset_glob("common.items.debug.*") {
|
|
||||||
server
|
|
||||||
.state()
|
|
||||||
.ecs()
|
|
||||||
.write_storage::<comp::Inventory>()
|
|
||||||
.get_mut(target)
|
|
||||||
.ok_or("Cannot get inventory for target")?
|
|
||||||
.push_all_unique(items.into_iter())
|
|
||||||
// Deliberately swallow the error if not enough debug items could be added--though it
|
|
||||||
// might be nice to let the admin know, it's better than dropping them on the ground.
|
|
||||||
.ok();
|
|
||||||
insert_or_replace_component(
|
|
||||||
server,
|
|
||||||
target,
|
|
||||||
comp::InventoryUpdate::new(comp::InventoryUpdateEvent::Debug),
|
|
||||||
"target",
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
Err("Debug items not found? Something is very broken.".into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_remove_lights(
|
fn handle_remove_lights(
|
||||||
server: &mut Server,
|
server: &mut Server,
|
||||||
client: EcsEntity,
|
client: EcsEntity,
|
||||||
|
Loading…
Reference in New Issue
Block a user