address comments

This commit is contained in:
Monty Marz 2020-08-07 21:27:15 +02:00 committed by Imbris
parent 74ace74d5a
commit 142b386628
6 changed files with 20 additions and 76 deletions

View File

@ -6,4 +6,5 @@ rustflags = [
[alias] [alias]
generate = "run --package tools --" generate = "run --package tools --"
test-server = "run --bin veloren-server-cli --no-default-features" test-server = "run --bin veloren-server-cli --no-default-features"
server = "run --bin veloren-server-cli"

View File

@ -308,7 +308,7 @@ magischen Gegenstände ergattern?"#,
"hud.settings.unbound": "-", "hud.settings.unbound": "-",
"hud.settings.reset_keybinds": "Auf Standard zurücksetzen", "hud.settings.reset_keybinds": "Auf Standard zurücksetzen",
"hud.social": "Andere Spieler ", "hud.social": "Andere Spieler",
"hud.social.online": "Online", "hud.social.online": "Online",
"hud.social.friends": "Freunde", "hud.social.friends": "Freunde",
"hud.social.not_yet_available": "Noch nicht verfügbar", "hud.social.not_yet_available": "Noch nicht verfügbar",

View File

@ -1045,6 +1045,14 @@ impl Client {
"Type /g or /group to chat with your group members", "Type /g or /group to chat with your group members",
))); )));
} }
if let Some(player_info) = self.player_list.get(&uid) {
frontend_events.push(Event::Chat(
comp::ChatType::GroupMeta("Group".into()).chat_msg(format!(
"[{}] joined group",
player_info.player_alias
)),
));
}
if self.group_members.insert(uid, role) == Some(role) { if self.group_members.insert(uid, role) == Some(role) {
warn!( warn!(
"Received msg to add uid {} to the group members but they \ "Received msg to add uid {} to the group members but they \
@ -1054,6 +1062,14 @@ impl Client {
} }
}, },
Removed(uid) => { Removed(uid) => {
if let Some(player_info) = self.player_list.get(&uid) {
frontend_events.push(Event::Chat(
comp::ChatType::GroupMeta("Group".into()).chat_msg(format!(
"[{}] left group",
player_info.player_alias
)),
));
}
if self.group_members.remove(&uid).is_none() { if self.group_members.remove(&uid).is_none() {
warn!( warn!(
"Received msg to remove uid {} from group members but by they \ "Received msg to remove uid {} from group members but by they \

View File

@ -50,7 +50,6 @@ pub enum ChatCommand {
Health, Health,
Help, Help,
JoinFaction, JoinFaction,
//JoinGroup,
Jump, Jump,
Kill, Kill,
KillNpcs, KillNpcs,
@ -92,7 +91,6 @@ pub static CHAT_COMMANDS: &[ChatCommand] = &[
ChatCommand::Health, ChatCommand::Health,
ChatCommand::Help, ChatCommand::Help,
ChatCommand::JoinFaction, ChatCommand::JoinFaction,
//ChatCommand::JoinGroup,
ChatCommand::Jump, ChatCommand::Jump,
ChatCommand::Kill, ChatCommand::Kill,
ChatCommand::KillNpcs, ChatCommand::KillNpcs,
@ -246,11 +244,6 @@ impl ChatCommand {
"Join/leave the specified faction", "Join/leave the specified faction",
NoAdmin, NoAdmin,
), ),
//ChatCommand::JoinGroup => ChatCommandData::new(
// vec![Any("group", Optional)],
// "Join/leave the specified group",
// NoAdmin,
//),
ChatCommand::Jump => cmd( ChatCommand::Jump => cmd(
vec![ vec![
Float("x", 0.0, Required), Float("x", 0.0, Required),
@ -383,7 +376,6 @@ impl ChatCommand {
ChatCommand::Group => "group", ChatCommand::Group => "group",
ChatCommand::Health => "health", ChatCommand::Health => "health",
ChatCommand::JoinFaction => "join_faction", ChatCommand::JoinFaction => "join_faction",
//ChatCommand::JoinGroup => "join_group",
ChatCommand::Help => "help", ChatCommand::Help => "help",
ChatCommand::Jump => "jump", ChatCommand::Jump => "jump",
ChatCommand::Kill => "kill", ChatCommand::Kill => "kill",

View File

@ -77,7 +77,6 @@ fn get_handler(cmd: &ChatCommand) -> CommandHandler {
ChatCommand::Health => handle_health, ChatCommand::Health => handle_health,
ChatCommand::Help => handle_help, ChatCommand::Help => handle_help,
ChatCommand::JoinFaction => handle_join_faction, ChatCommand::JoinFaction => handle_join_faction,
//ChatCommand::JoinGroup => handle_join_group,
ChatCommand::Jump => handle_jump, ChatCommand::Jump => handle_jump,
ChatCommand::Kill => handle_kill, ChatCommand::Kill => handle_kill,
ChatCommand::KillNpcs => handle_kill_npcs, ChatCommand::KillNpcs => handle_kill_npcs,
@ -588,7 +587,6 @@ fn handle_spawn(
comp::Alignment::Npc | comp::Alignment::Tame => { comp::Alignment::Npc | comp::Alignment::Tame => {
Some(comp::group::NPC) Some(comp::group::NPC)
}, },
// TODO: handle
comp::Alignment::Owned(_) => unreachable!(), comp::Alignment::Owned(_) => unreachable!(),
} { } {
let _ = let _ =
@ -1362,69 +1360,6 @@ fn handle_join_faction(
} }
} }
// TODO: it might be useful to copy the GroupMeta messages elsewhere
/*fn handle_join_group(
server: &mut Server,
client: EcsEntity,
target: EcsEntity,
args: String,
action: &ChatCommand,
) {
if client != target {
// This happens when [ab]using /sudo
server.notify_client(
client,
ChatType::CommandError.server_msg("It's rude to impersonate people"),
);
return;
}
if let Some(alias) = server
.state
.ecs()
.read_storage::<comp::Player>()
.get(target)
.map(|player| player.alias.clone())
{
let group_leave = if let Ok(group) = scan_fmt!(&args, &action.arg_fmt(), String) {
let mode = comp::ChatMode::Group(group.clone());
let _ = server.state.ecs().write_storage().insert(client, mode);
let group_leave = server
.state
.ecs()
.write_storage()
.insert(client, comp::ChatGroup(group.clone()))
.ok()
.flatten()
.map(|f| f.0);
server.state.send_chat(
ChatType::GroupMeta(group.clone())
.chat_msg(format!("[{}] joined group ({})", alias, group)),
);
group_leave
} else {
let mode = comp::ChatMode::default();
let _ = server.state.ecs().write_storage().insert(client, mode);
server
.state
.ecs()
.write_storage()
.remove(client)
.map(|comp::ChatGroup(f)| f)
};
if let Some(group) = group_leave {
server.state.send_chat(
ChatType::GroupMeta(group.clone())
.chat_msg(format!("[{}] left group ({})", alias, group)),
);
}
} else {
server.notify_client(
client,
ChatType::CommandError.server_msg("Could not find your player alias"),
);
}
}*/
#[cfg(not(feature = "worldgen"))] #[cfg(not(feature = "worldgen"))]
fn handle_debug_column( fn handle_debug_column(
server: &mut Server, server: &mut Server,

View File

@ -1190,9 +1190,9 @@ impl<'a> Widget for SettingsWindow<'a> {
.color(TEXT_COLOR) .color(TEXT_COLOR)
.set(state.ids.chat_char_name_text, ui); .set(state.ids.chat_char_name_text, ui);
// Show account name in chat // TODO Show account name in chat
// Show account names in social window // TODO Show account names in social window
// Language select drop down // Language select drop down
Text::new(&self.localized_strings.get("common.languages")) Text::new(&self.localized_strings.get("common.languages"))