Merge branch 'which_object_spawned' into 'master'

Tells the user which object was spawned

See merge request veloren/veloren!368
This commit is contained in:
Imbris 2019-09-02 05:34:28 +00:00
commit 53c0992fd5

View File

@ -555,7 +555,8 @@ fn handle_object(server: &mut Server, entity: EcsEntity, args: String, _action:
.create_object(pos, ori, obj_type)
.with(ori);*/
if let (Some(pos), Some(ori)) = (pos, ori) {
let obj_type = match obj_type.as_ref().map(String::as_str) {
let obj_str_res = obj_type.as_ref().map(String::as_str);
let obj_type = match obj_str_res {
Ok("scarecrow") => comp::object::Body::Scarecrow,
Ok("cauldron") => comp::object::Body::Cauldron,
Ok("chest_vines") => comp::object::Body::ChestVines,
@ -624,9 +625,13 @@ fn handle_object(server: &mut Server, entity: EcsEntity, args: String, _action:
.normalized(),
))
.build();
server
.clients
.notify(entity, ServerMsg::private(format!("Spawned object.")));
server.clients.notify(
entity,
ServerMsg::private(format!(
"Spawned: {}",
obj_str_res.unwrap_or("<Unknown object>")
)),
);
} else {
server
.clients