From 06212c7d8dc20b11f49d54e42f8299740f90a231 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 9 Nov 2008 17:44:24 +0000 Subject: improved client notifications, minor bugfixes --- src/game/base/base.cc | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/game') diff --git a/src/game/base/base.cc b/src/game/base/base.cc index ce5eb1c..58b89a2 100644 --- a/src/game/base/base.cc +++ b/src/game/base/base.cc @@ -62,13 +62,15 @@ void Base::func_join(core::Player *player, std::string const &args) ship->set_eventstate(core::Entity::Docked); player->set_view(dock); } - player->sound("game/buy-ship"); std::string message("^B"); message.append(player->name()); message.append("^B joins the game."); core::server()->broadcast(message); + player->send("^BYou received " + aux::article(Base::default_shipmodel->name())); + player->sound("game/buy-ship"); + player->player_dirty = true; } @@ -96,7 +98,13 @@ void Base::func_spectate(core::Player *player, std::string const &args) // a player buys a ship void Base::func_buy(core::Player *player, std::string const &args) { - + if (!g_devel->value() && !player->view()) { + player->send("Cheats disabled."); + return; + } + + // FIXME verify the base sells this ship + std::string shipname; std::string helpstr; std::istringstream is(args); @@ -134,7 +142,7 @@ void Base::func_buy(core::Player *player, std::string const &args) player->set_view(dock); } - core::server()->broadcast("^B" + player->name() + " ^Bpurchased " + aux::article(shipmodel->name())); + player->send("^BPurchased " + aux::article(shipmodel->name())); player->sound("game/buy-ship"); } else { @@ -146,7 +154,7 @@ void Base::func_buy(core::Player *player, std::string const &args) void Base::func_hail(core::Player *player, std::string const &args) { if (player->mute()) { - player->send("^BYou have been muted."); + player->send("You have been muted."); return; } @@ -159,7 +167,7 @@ void Base::func_hail(core::Player *player, std::string const &args) core::Player *targetplayer = core::server()->find_player(target); if (!targetplayer) { - player->send("^BPlayer " + target + "^B not found."); + player->send("Player " + target + "^N not found."); return; } @@ -167,7 +175,7 @@ void Base::func_hail(core::Player *player, std::string const &args) player->sound("com/hail"); targetplayer->send("^B" + player->name() + "^B hails you!"); - targetplayer->send("com/hail"); + targetplayer->sound("com/hail"); } // a player actives the hyperspace jump drive on his ship @@ -208,7 +216,7 @@ void Base::func_dock(core::Player *player,core::Entity *entity) return; if (math::distance(entity->location(), player->control()->location()) > 2.0f * (entity->radius() + player->control()->radius())) { - player->send("^B" + entity->name() + " is out of range!"); + player->send("Target out of range!"); return; } @@ -245,8 +253,10 @@ void Base::func_goto(core::Player *player, const std::string &args) if (!args.size()) return; - if (!g_devel->value()) + if (!g_devel->value()) { + player->send("Cheats disabled."); return; + } if (!player->control()) return; @@ -268,6 +278,7 @@ void Base::func_goto(core::Player *player, const std::string &args) return; } } + player->send("Entity '" + args + "' not found."); } /* -- class Base -------------------------------------------------- */ @@ -559,11 +570,12 @@ bool Base::load_zone(core::Zone *zone) } else if (zoneini.got_key_float("rotationspeed", planet->entity_rotationspeed)) { continue; } else if (zoneini.got_key_bool("dock", b)) { - if (b) + if (b) { planet->set_flag(core::Entity::Dockable); - else + core::Descriptions::load_entity_menus(planet, "zones/" + zone->label() + "/" + planet->label()); + } else { planet->unset_flag(core::Entity::Dockable); - + } } else if (zoneini.got_key_bool("default", b)) { if (b) { zone->set_default_view(planet); -- cgit v1.2.3