Merge branch 'TheThirdSpartan/chat-fixes' into 'master'

Small chat message formatting changes and fixed missing player alias during admin entity possession

See merge request veloren/veloren!1782
This commit is contained in:
Imbris 2021-02-17 02:15:46 +00:00
commit 1067d66862
16 changed files with 85 additions and 48 deletions

View File

@ -179,7 +179,7 @@ https://veloren.net/account/.
// Chat outputs // Chat outputs
"hud.chat.online_msg": "[{name}] ist jetzt online.", "hud.chat.online_msg": "[{name}] ist jetzt online.",
"hud.chat.offline_msg": "{name} ist jetzt offline.", "hud.chat.offline_msg": "[{name}] ist jetzt offline.",
"hud.chat.loot_msg": "Ihr erhaltet [{item}]", "hud.chat.loot_msg": "Ihr erhaltet [{item}]",
"hud.chat.loot_fail": "Euer Inventar ist voll!", "hud.chat.loot_fail": "Euer Inventar ist voll!",
"hud.chat.goodbye": "Verbindung getrennt.", "hud.chat.goodbye": "Verbindung getrennt.",
@ -200,8 +200,8 @@ https://veloren.net/account/.
"hud.chat.npc_melee_kill_msg": "{attacker} tötete [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} tötete [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} tötete [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} tötete [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} hat [{victim}] hochgejagt", "hud.chat.npc_explosion_kill_msg": "{attacker} hat [{victim}] hochgejagt",
"hud.chat.npc_energy_kill_msg": "[{attacker}] hat [{victim}] mit Magie erledigt", "hud.chat.npc_energy_kill_msg": "{attacker} hat [{victim}] mit Magie erledigt",
"hud.chat.npc_other_kill_msg": "[{attacker}] tötete [{victim}]", "hud.chat.npc_other_kill_msg": "{attacker} tötete [{victim}]",
// SCT outputs // SCT outputs
"hud.sct.experience": "{amount} Erf", "hud.sct.experience": "{amount} Erf",
@ -392,7 +392,7 @@ magischen Gegenstände ergattern?"#,
"hud.social.zone" : "Gebiet", "hud.social.zone" : "Gebiet",
"hud.group": "Gruppe", "hud.group": "Gruppe",
"hud.group.invite_to_join": "{name} lädt euch in seine Gruppe ein!", "hud.group.invite_to_join": "[{name}] lädt euch in seine Gruppe ein!",
"hud.group.invite": "Einladen", "hud.group.invite": "Einladen",
"hud.group.kick": "Kicken", "hud.group.kick": "Kicken",
"hud.group.assign_leader": "Anführer", "hud.group.assign_leader": "Anführer",

View File

@ -5,7 +5,7 @@
string_map: { string_map: {
// Chat outputs // Chat outputs
"hud.chat.online_msg": "[{name}] is online now", "hud.chat.online_msg": "[{name}] is online now",
"hud.chat.offline_msg": "{name} went offline", "hud.chat.offline_msg": "[{name}] went offline",
"hud.chat.default_death_msg": "[{name}] died", "hud.chat.default_death_msg": "[{name}] died",
"hud.chat.environmental_kill_msg": "[{name}] died in {environment}", "hud.chat.environmental_kill_msg": "[{name}] died in {environment}",
@ -20,12 +20,12 @@
"hud.chat.nonexistent_buff_kill_msg": "[{victim}] died of {buff}", "hud.chat.nonexistent_buff_kill_msg": "[{victim}] died of {buff}",
"hud.chat.npc_buff_kill_msg": "[{victim}] died of {buff} caused by [{attacker}]", "hud.chat.npc_buff_kill_msg": "[{victim}] died of {buff} caused by {attacker}",
"hud.chat.npc_melee_kill_msg": "{attacker} killed [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} killed [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} shot [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} shot [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} blew up [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} blew up [{victim}]",
"hud.chat.npc_energy_kill_msg": "[{attacker}] killed [{victim}] with magic", "hud.chat.npc_energy_kill_msg": "{attacker} killed [{victim}] with magic",
"hud.chat.npc_other_kill_msg": "[{attacker}] killed [{victim}]", "hud.chat.npc_other_kill_msg": "{attacker} killed [{victim}]",
"hud.chat.loot_msg": "You picked up [{item}]", "hud.chat.loot_msg": "You picked up [{item}]",
"hud.chat.loot_fail": "Your Inventory is full!", "hud.chat.loot_fail": "Your Inventory is full!",

View File

@ -4,8 +4,8 @@
( (
string_map: { string_map: {
"hud.group": "Group", "hud.group": "Group",
"hud.group.invite_to_join": "{name} invited you to their group!", "hud.group.invite_to_join": "[{name}] invited you to their group!",
"hud.group.invite_to_trade": "{name} would like to trade with you.", "hud.group.invite_to_trade": "[{name}] would like to trade with you.",
"hud.group.invite": "Invite", "hud.group.invite": "Invite",
"hud.group.kick": "Kick", "hud.group.kick": "Kick",
"hud.group.assign_leader": "Assign Leader", "hud.group.assign_leader": "Assign Leader",

View File

@ -197,8 +197,8 @@ https://veloren.net/account/."#,
"hud.chat.npc_melee_kill_msg": "{attacker} mató a [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} mató a [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} le disparó a [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} le disparó a [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} hizo explotar a [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} hizo explotar a [{victim}]",
"hud.chat.npc_energy_kill_msg": "[{attacker}] usó magia para matar a [{victim}]", "hud.chat.npc_energy_kill_msg": "{attacker} usó magia para matar a [{victim}]",
"hud.chat.npc_other_kill_msg": "[{attacker}] mató a [{victim}]", "hud.chat.npc_other_kill_msg": "{attacker} mató a [{victim}]",
"hud.chat.loot_msg": "Recogiste [{item}]", "hud.chat.loot_msg": "Recogiste [{item}]",
"hud.chat.loot_fail": "Tu inventario está lleno!", "hud.chat.loot_fail": "Tu inventario está lleno!",
@ -397,7 +397,7 @@ objetos infundidos con magia?"#,
"hud.crafting.tool_cata": "Requisitos:", "hud.crafting.tool_cata": "Requisitos:",
"hud.group": "Grupo", "hud.group": "Grupo",
"hud.group.invite_to_join": "{name} Te invito a su Grupo!", "hud.group.invite_to_join": "[{name}] Te invito a su Grupo!",
"hud.group.invite": "Invitar", "hud.group.invite": "Invitar",
"hud.group.kick": "Echar", "hud.group.kick": "Echar",
"hud.group.assign_leader": "Asignar Lider", "hud.group.assign_leader": "Asignar Lider",

View File

@ -180,8 +180,8 @@ https://veloren.net/account/."#,
"hud.chat.npc_melee_kill_msg": "{attacker} a tué [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} a tué [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} a tiré sur [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} a tiré sur [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} a explosé [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} a explosé [{victim}]",
"hud.chat.npc_energy_kill_msg": "[{attacker}] a tué [{victim}] avec de la magie", "hud.chat.npc_energy_kill_msg": "{attacker} a tué [{victim}] avec de la magie",
"hud.chat.npc_other_kill_msg": "[{attacker}] a tué [{victim}]", "hud.chat.npc_other_kill_msg": "{attacker} a tué [{victim}]",
"hud.chat.loot_msg": "Vous avez ramassé [{item}]", "hud.chat.loot_msg": "Vous avez ramassé [{item}]",
"hud.chat.loot_fail": "Votre inventaire est plein!", "hud.chat.loot_fail": "Votre inventaire est plein!",
@ -377,7 +377,7 @@ objets magiques ?"#,
"hud.crafting.tool_cata": "Nécessite:", "hud.crafting.tool_cata": "Nécessite:",
"hud.group": "Groupe", "hud.group": "Groupe",
"hud.group.invite_to_join": "{name} vous a invité dans son groupe!", "hud.group.invite_to_join": "[{name}] vous a invité dans son groupe!",
"hud.group.invite": "Inviter", "hud.group.invite": "Inviter",
"hud.group.kick": "Exclure", // <- need confirmation "hud.group.kick": "Exclure", // <- need confirmation
"hud.group.assign_leader": "Assigner Chef", "hud.group.assign_leader": "Assigner Chef",

View File

@ -175,7 +175,7 @@ https://veloren.net/account/."#,
// Chat outputs // Chat outputs
"hud.chat.online_msg": "[{name}] is nu online", "hud.chat.online_msg": "[{name}] is nu online",
"hud.chat.offline_msg": "{name} is offline gegaan", "hud.chat.offline_msg": "[{name}] is offline gegaan",
"hud.chat.default_death_msg": "[{name}] is gestorven", "hud.chat.default_death_msg": "[{name}] is gestorven",
"hud.chat.environmental_kill_msg": "[{name}] is gestorven in {environment}", "hud.chat.environmental_kill_msg": "[{name}] is gestorven in {environment}",
@ -382,7 +382,7 @@ herstellen",
"hud.crafting.tool_cata": "Vereisten:", "hud.crafting.tool_cata": "Vereisten:",
"hud.group": "Groep", "hud.group": "Groep",
"hud.group.invite_to_join": "{name} heeft je voor zijn/haar groep uitgenodigd!", "hud.group.invite_to_join": "[{name}] heeft je voor zijn/haar groep uitgenodigd!",
"hud.group.invite": "Uitnodigen", "hud.group.invite": "Uitnodigen",
"hud.group.kick": "Kick", "hud.group.kick": "Kick",
"hud.group.assign_leader": "Maak Leider", "hud.group.assign_leader": "Maak Leider",

View File

@ -180,7 +180,7 @@ https://veloren.net/account/."#,
// Chat outputs // Chat outputs
"hud.chat.online_msg": "[{name}] logget på", "hud.chat.online_msg": "[{name}] logget på",
"hud.chat.offline_msg": "{name} logget av", "hud.chat.offline_msg": "[{name}] logget av",
"hud.chat.default_death_msg": "[{name}] døde", "hud.chat.default_death_msg": "[{name}] døde",
"hud.chat.environmental_kill_msg": "[{name}] døde i {environment}", "hud.chat.environmental_kill_msg": "[{name}] døde i {environment}",
@ -197,8 +197,8 @@ https://veloren.net/account/."#,
"hud.chat.npc_melee_kill_msg": "{attacker} drepte [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} drepte [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} skjøt [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} skjøt [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} sprengte [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} sprengte [{victim}]",
"hud.chat.npc_energy_kill_msg": "[{attacker}] drepte [{victim}] med magi", "hud.chat.npc_energy_kill_msg": "{attacker} drepte [{victim}] med magi",
"hud.chat.npc_other_kill_msg": "[{attacker}] drepte [{victim}]", "hud.chat.npc_other_kill_msg": "{attacker} drepte [{victim}]",
"hud.chat.loot_msg": "Du plukket opp [{item}]", "hud.chat.loot_msg": "Du plukket opp [{item}]",
"hud.chat.loot_fail": "Ditt inventar er fullt!", "hud.chat.loot_fail": "Ditt inventar er fullt!",
@ -394,7 +394,7 @@ magisk infunderte gjenstandene?"#,
"hud.crafting.tool_cata": "Krever:", "hud.crafting.tool_cata": "Krever:",
"hud.group": "Gruppe", "hud.group": "Gruppe",
"hud.group.invite_to_join": "{name} inviterte deg til gruppen deres!", "hud.group.invite_to_join": "[{name}] inviterte deg til gruppen deres!",
"hud.group.invite": "Inviter", "hud.group.invite": "Inviter",
"hud.group.kick": "Spark", "hud.group.kick": "Spark",
"hud.group.assign_leader": "Tilordne leder", "hud.group.assign_leader": "Tilordne leder",

View File

@ -184,8 +184,8 @@ https://veloren.net/account/."#,
"hud.chat.npc_melee_kill_msg": "{attacker} matou [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} matou [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} acertou [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} acertou [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} exoplodiu [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} exoplodiu [{victim}]",
"hud.chat.npc_energy_kill_msg": "[{attacker}] matou [{victim}] com magia", "hud.chat.npc_energy_kill_msg": "{attacker} matou [{victim}] com magia",
"hud.chat.npc_buff_kill_msg": "[{attacker}] matou [{victim}]", "hud.chat.npc_buff_kill_msg": "{attacker} matou [{victim}]",
"hud.chat.loot_msg": "Você pegou [{item}]", "hud.chat.loot_msg": "Você pegou [{item}]",
"hud.chat.loot_fail": "Seu inventário está cheio!", "hud.chat.loot_fail": "Seu inventário está cheio!",
@ -383,7 +383,7 @@ itens magicamente modificados?"#,
"hud.crafting.tool_cata": "Precisa de:", "hud.crafting.tool_cata": "Precisa de:",
"hud.group": "Grupo", "hud.group": "Grupo",
"hud.group.invite_to_join": "{name} convidou você para o grupo!", "hud.group.invite_to_join": "[{name}] convidou você para o grupo!",
"hud.group.invite": "Convidar", "hud.group.invite": "Convidar",
"hud.group.kick": "Expulsar", "hud.group.kick": "Expulsar",
"hud.group.assign_leader": "Atribuír líder", "hud.group.assign_leader": "Atribuír líder",

View File

@ -196,8 +196,8 @@ https://veloren.net/account/."#,
"hud.chat.npc_melee_kill_msg": "{attacker} убил [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} убил [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} подстрелил [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} подстрелил [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} взорвал [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} взорвал [{victim}]",
"hud.chat.npc_energy_kill_msg": "[{attacker}] убил [{victim}] с помощью магии", "hud.chat.npc_energy_kill_msg": "{attacker} убил [{victim}] с помощью магии",
"hud.chat.npc_other_kill_msg": "[{attacker}] убил [{victim}]", "hud.chat.npc_other_kill_msg": "{attacker} убил [{victim}]",
"hud.chat.loot_msg": "Вы подобрали [{item}]", "hud.chat.loot_msg": "Вы подобрали [{item}]",
"hud.chat.loot_fail": "Ваш инвентарь полон!", "hud.chat.loot_fail": "Ваш инвентарь полон!",
@ -395,7 +395,7 @@ https://veloren.net/account/."#,
"hud.crafting.tool_cata": "Требуется:", "hud.crafting.tool_cata": "Требуется:",
"hud.group": "Группа", "hud.group": "Группа",
"hud.group.invite_to_join": "{name} пригласил вас в свою группу!", "hud.group.invite_to_join": "[{name}] пригласил вас в свою группу!",
"hud.group.invite": "Пригласить", "hud.group.invite": "Пригласить",
"hud.group.kick": "Кикнуть", "hud.group.kick": "Кикнуть",
"hud.group.assign_leader": "Назначить лидером", "hud.group.assign_leader": "Назначить лидером",

View File

@ -19,11 +19,11 @@
"hud.chat.pvp_buff_kill_msg": "[{victim}], [{attacker}] tarafından öldürüldü.", "hud.chat.pvp_buff_kill_msg": "[{victim}], [{attacker}] tarafından öldürüldü.",
"hud.chat.npc_melee_kill_msg": "[{victim}], [{attacker}] tarafından mağlup edildi.", "hud.chat.npc_melee_kill_msg": "[{victim}], {attacker} tarafından mağlup edildi.",
"hud.chat.npc_ranged_kill_msg": "[{victim}], [{attacker}] tarafından vuruldu.", "hud.chat.npc_ranged_kill_msg": "[{victim}], {attacker} tarafından vuruldu.",
"hud.chat.npc_explosion_kill_msg": "[{victim}], [{attacker}] tarafından havaya uçuruldu.", "hud.chat.npc_explosion_kill_msg": "[{victim}], {attacker} tarafından havaya uçuruldu.",
"hud.chat.npc_energy_kill_msg": "[{victim}], [{attacker}] tarafından büyü ile mağlup edildi.", "hud.chat.npc_energy_kill_msg": "[{victim}], {attacker} tarafından büyü ile mağlup edildi.",
"hud.chat.npc_other_kill_msg": "[{victim}], [{attacker}] tarafından öldürüldü.", "hud.chat.npc_other_kill_msg": "[{victim}], {attacker} tarafından öldürüldü.",
"hud.chat.loot_msg": "[{item}] topladın.", "hud.chat.loot_msg": "[{item}] topladın.",
"hud.chat.loot_fail": "Envanterin dolu!", "hud.chat.loot_fail": "Envanterin dolu!",

View File

@ -4,7 +4,7 @@
( (
string_map: { string_map: {
"hud.group": "Grup", "hud.group": "Grup",
"hud.group.invite_to_join": "{name} seni grubuna davet etti!", "hud.group.invite_to_join": "[{name}] seni grubuna davet etti!",
"hud.group.invite": "Davet Et", "hud.group.invite": "Davet Et",
"hud.group.kick": "Gruptan At", "hud.group.kick": "Gruptan At",
"hud.group.assign_leader": "Lider Seç", "hud.group.assign_leader": "Lider Seç",

View File

@ -5,7 +5,7 @@
string_map: { string_map: {
// Chat outputs // Chat outputs
"hud.chat.online_msg": "[{name}] в мережі", "hud.chat.online_msg": "[{name}] в мережі",
"hud.chat.offline_msg": "{name} не в мережі", "hud.chat.offline_msg": "[{name}] не в мережі",
"hud.chat.default_death_msg": "[{name}] помер(ла)", "hud.chat.default_death_msg": "[{name}] помер(ла)",
"hud.chat.environmental_kill_msg": "[{name}] помер(ла) в {environment}", "hud.chat.environmental_kill_msg": "[{name}] помер(ла) в {environment}",
@ -20,12 +20,12 @@
"hud.chat.nonexistent_buff_kill_msg": "[{victim}] помер(ла) від: {buff}", "hud.chat.nonexistent_buff_kill_msg": "[{victim}] помер(ла) від: {buff}",
"hud.chat.npc_buff_kill_msg": "[{victim}] помер(ла) від: {buff} через: [{attacker}]", "hud.chat.npc_buff_kill_msg": "[{victim}] помер(ла) від: {buff} через: {attacker}",
"hud.chat.npc_melee_kill_msg": "{attacker} вбив(ла) [{victim}]", "hud.chat.npc_melee_kill_msg": "{attacker} вбив(ла) [{victim}]",
"hud.chat.npc_ranged_kill_msg": "{attacker} застрелив(ла) [{victim}]", "hud.chat.npc_ranged_kill_msg": "{attacker} застрелив(ла) [{victim}]",
"hud.chat.npc_explosion_kill_msg": "{attacker} підірвав(ла) [{victim}]", "hud.chat.npc_explosion_kill_msg": "{attacker} підірвав(ла) [{victim}]",
"hud.chat.npc_energy_kill_msg": "[{attacker}] вбив(ла) [{victim}] магією", "hud.chat.npc_energy_kill_msg": "{attacker} вбив(ла) [{victim}] магією",
"hud.chat.npc_other_kill_msg": "[{attacker}] вбив(ла) [{victim}]", "hud.chat.npc_other_kill_msg": "{attacker} вбив(ла) [{victim}]",
"hud.chat.loot_msg": "Ви підібрали [{item}]", "hud.chat.loot_msg": "Ви підібрали [{item}]",
"hud.chat.loot_fail": "Ваш інвентар переповнено!", "hud.chat.loot_fail": "Ваш інвентар переповнено!",

View File

@ -4,7 +4,7 @@
( (
string_map: { string_map: {
"hud.group": "Група", "hud.group": "Група",
"hud.group.invite_to_join": "{name} запросив(ла) Вас до їхньої групи!", "hud.group.invite_to_join": "[{name}] запросив(ла) Вас до їхньої групи!",
"hud.group.invite": "Запросити", "hud.group.invite": "Запросити",
"hud.group.kick": "Викинути", "hud.group.kick": "Викинути",
"hud.group.assign_leader": "Призначити лідером", "hud.group.assign_leader": "Призначити лідером",

View File

@ -332,7 +332,7 @@ Veloren 的夜晚会变得非常的黑.
"hud.crafting.tool_cata": "需要:", "hud.crafting.tool_cata": "需要:",
"hud.group": "队伍", "hud.group": "队伍",
"hud.group.invite_to_join": "{name} 邀请你加入它们的队伍!", "hud.group.invite_to_join": "[{name}] 邀请你加入它们的队伍!",
"hud.group.invite": "邀请", "hud.group.invite": "邀请",
"hud.group.kick": "踢出", "hud.group.kick": "踢出",
"hud.group.assign_leader": "指定队长", "hud.group.assign_leader": "指定队长",

View File

@ -1909,7 +1909,7 @@ impl Client {
format!("{:?}", buff_kind).to_lowercase().as_str() format!("{:?}", buff_kind).to_lowercase().as_str()
), ),
KillSource::NonPlayer(attacker_name, KillType::Buff(buff_kind)) => format!( KillSource::NonPlayer(attacker_name, KillType::Buff(buff_kind)) => format!(
"[{}] died of {} caused by [{}]", "[{}] died of {} caused by {}",
alias_of_uid(victim), alias_of_uid(victim),
format!("{:?}", buff_kind).to_lowercase().as_str(), format!("{:?}", buff_kind).to_lowercase().as_str(),
attacker_name attacker_name

View File

@ -11,6 +11,7 @@ use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
use crate::{ use crate::{
client::Client, client::Client,
presence::{Presence, RegionSubscription}, presence::{Presence, RegionSubscription},
state_ext::StateExt,
Server, Server,
}; };
@ -133,16 +134,56 @@ pub fn handle_possess(server: &Server, possessor_uid: Uid, possesse_uid: Uid) {
return; return;
} }
let mut clients = ecs.write_storage::<Client>(); if ecs.read_storage::<Client>().get(possesse).is_some() {
if clients.get_mut(possesse).is_some() {
error!("can't possess other players"); error!("can't possess other players");
return; return;
} }
match (|| -> Option<Result<(), specs::error::Error>> { match (|| -> Option<Result<(), specs::error::Error>> {
let mut clients = ecs.write_storage::<Client>();
let c = clients.remove(possessor)?; let c = clients.remove(possessor)?;
clients.insert(possesse, c).ok()?; clients.insert(possesse, c).ok()?;
let playerlist_messages = if let Some(client) = clients.get(possesse) {
client.send_fallible(ServerGeneral::SetPlayerEntity(possesse_uid));
// If a player is posessing non player, add possesse to playerlist as player and
// remove old player
if let Some(possessor_player) = ecs.read_storage::<comp::Player>().get(possessor) {
let admins = ecs.read_storage::<comp::Admin>();
let entity_possession_msg = ServerGeneral::PlayerListUpdate(
common_net::msg::server::PlayerListUpdate::Add(
possesse_uid,
common_net::msg::server::PlayerInfo {
player_alias: possessor_player.alias.clone(),
is_online: true,
is_admin: admins.get(possessor).is_some(),
character: ecs.read_storage::<comp::Stats>().get(possesse).map(
|s| common_net::msg::CharacterInfo {
name: s.name.clone(),
},
),
},
),
);
let remove_old_player_msg = ServerGeneral::PlayerListUpdate(
common_net::msg::server::PlayerListUpdate::Remove(possessor_uid),
);
// Send msg to new possesse client now because it is not yet considered a player
// and will be missed by notify_players
client.send_fallible(entity_possession_msg.clone());
client.send_fallible(remove_old_player_msg.clone());
Some((remove_old_player_msg, entity_possession_msg))
} else {
None
}
} else {
None
};
drop(clients);
if let Some((remove_player, possess_entity)) = playerlist_messages {
server.state().notify_players(possess_entity);
server.state().notify_players(remove_player);
}
//optional entities //optional entities
let mut players = ecs.write_storage::<comp::Player>(); let mut players = ecs.write_storage::<comp::Player>();
let mut presence = ecs.write_storage::<Presence>(); let mut presence = ecs.write_storage::<Presence>();
@ -178,10 +219,6 @@ pub fn handle_possess(server: &Server, possessor_uid: Uid, possesse_uid: Uid) {
}, },
} }
clients
.get_mut(possesse)
.map(|c| c.send_fallible(ServerGeneral::SetPlayerEntity(possesse_uid)));
// Put possess item into loadout // Put possess item into loadout
let mut inventories = ecs.write_storage::<Inventory>(); let mut inventories = ecs.write_storage::<Inventory>();
let mut inventory = inventories let mut inventory = inventories