Merge branch 'crab/fix-player-trading' into 'master'

Allow trading from player to player again

See merge request veloren/veloren!4554
This commit is contained in:
Marcel 2024-08-15 13:44:16 +00:00
commit 83191551c5

View File

@ -1133,7 +1133,7 @@ impl PlayState for SessionState {
match interactable { match interactable {
Interactable::Block(_, _, _) => {}, Interactable::Block(_, _, _) => {},
Interactable::Entity(entity) => { Interactable::Entity(entity) => {
let can_trade_to = client let can_trade_to_alignment = client
.state() .state()
.read_component_cloned::<Alignment>(*entity) .read_component_cloned::<Alignment>(*entity)
.is_some_and(|a| match a { .is_some_and(|a| match a {
@ -1148,11 +1148,10 @@ impl PlayState for SessionState {
_ => false, _ => false,
}); });
if can_trade_to if let Some(uid) =
&& let Some(uid) = client client.state().ecs().uid_from_entity(*entity)
.state() && (can_trade_to_alignment
.ecs() || client.player_list().contains_key(&uid))
.uid_from_entity(*entity)
{ {
let name = client let name = client
.player_list() .player_list()