mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch '191_player_to_player_dm' into 'master'
Add "You tell {}" message to sending player, closes #191 Closes #191 See merge request veloren/veloren!341
This commit is contained in:
commit
81ca86ad06
@ -449,33 +449,43 @@ fn handle_msg(server: &mut Server, entity: EcsEntity, args: String, action: &Cha
|
|||||||
let msg = &args[alias.len()..args.len()];
|
let msg = &args[alias.len()..args.len()];
|
||||||
match opt_player {
|
match opt_player {
|
||||||
Some(player) => {
|
Some(player) => {
|
||||||
if msg.len() > 1 {
|
if player != entity {
|
||||||
let opt_name = ecs
|
if msg.len() > 1 {
|
||||||
.read_storage::<comp::Player>()
|
let opt_name = ecs
|
||||||
.get(entity)
|
.read_storage::<comp::Player>()
|
||||||
.map(|s| s.alias.clone());
|
.get(entity)
|
||||||
match opt_name {
|
.map(|s| s.alias.clone());
|
||||||
Some(name) => {
|
match opt_name {
|
||||||
server.clients.notify(
|
Some(name) => {
|
||||||
player,
|
server.clients.notify(
|
||||||
ServerMsg::Chat(format!("{} tells you:{}", name, msg)),
|
player,
|
||||||
);
|
ServerMsg::Chat(format!("{} tells you:{}", name, msg)),
|
||||||
}
|
);
|
||||||
None => {
|
server.clients.notify(
|
||||||
server.clients.notify(
|
player,
|
||||||
entity,
|
ServerMsg::Chat(format!("You tell {} {}", alias, msg)),
|
||||||
ServerMsg::Chat(String::from("You do not exist!")),
|
);
|
||||||
);
|
}
|
||||||
|
None => {
|
||||||
|
server.clients.notify(
|
||||||
|
entity,
|
||||||
|
ServerMsg::Chat(String::from("You do not exist!")),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
server.clients.notify(
|
||||||
|
entity,
|
||||||
|
ServerMsg::Chat(format!(
|
||||||
|
"You really should say something to {}!",
|
||||||
|
alias
|
||||||
|
)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.clients.notify(
|
server
|
||||||
entity,
|
.clients
|
||||||
ServerMsg::Chat(format!(
|
.notify(entity, ServerMsg::Chat(format!("Don't be crazy!")));
|
||||||
"You really should say something to {}!",
|
|
||||||
alias
|
|
||||||
)),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
|
Loading…
Reference in New Issue
Block a user