From 83d6c17799c4d448a67ab5cdad02954282fa5c94 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 1 Nov 2008 13:33:18 +0000 Subject: server-side model loading, initial @dock function --- src/game/base/base.cc | 17 ++++++++++++++++- src/game/base/ship.cc | 7 ++++--- src/game/intro/convoy.cc | 2 +- src/game/intro/intro.cc | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src/game') diff --git a/src/game/base/base.cc b/src/game/base/base.cc index 738db04..6a3738e 100644 --- a/src/game/base/base.cc +++ b/src/game/base/base.cc @@ -159,6 +159,18 @@ void func_impulse(core::Player *player, std::string const &args) ship->impulse(); } +/// a player sends a docking request +void func_dock(core::Player *player,core::Entity *entity) +{ + if (!player->control()) + return; + + if (player->control()->zone() != entity->zone()) + return; + + core::server()->send(player, "^BSending docking request to " + entity->name() + "^B..."); +} + /* -- class Base static members ----------------------------------- */ // game variables @@ -211,6 +223,9 @@ void Base::init() func = core::Func::add("buy", (core::GameFuncPtr) func_buy); func->set_info("buy a ship"); + func = core::Func::add("@dock", (core::TargetFuncPtr) func_dock); + func->set_info("send a docking request"); + func = core::Func::add("jump", (core::GameFuncPtr) func_jump); func->set_info("[string] activate or deactivate hyperspace jump drive"); @@ -389,7 +404,7 @@ bool Base::load_zone(core::Zone *zone) } else if (zoneini.got_section("entity")) { entity = new core::Entity(); - entity->entity_flags += core::Entity::Static; + entity->set_flag(core::Entity::Static); entity->set_zone(zone); count ++; diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 574d66c..412668d 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -26,9 +26,9 @@ const float MIN_DELTA = 0.000001f; Ship::Ship(core::Player *owner, ShipModel *shipmodel) : core::EntityControlable(owner, ship_enttype) { - entity_modelname = "ships/" + shipmodel->modelname(); - entity_name = shipmodel->name() + ": <^B" + owner->name() + "^N>"; - entity_label = shipmodel->label(); + set_modelname("ships/" + shipmodel->modelname()); + set_name(shipmodel->name() + ": <^B" + owner->name() + "^N>"); + set_label(shipmodel->label()); entity_moduletypeid = ship_enttype; @@ -266,6 +266,7 @@ void Ship::frame(float seconds) entity_dirty = true; // FIXME 5 second cooldown + entity_speed = Base::g_impulsespeed->value(); entity_eventstate = core::Entity::Normal; } else if (entity_eventstate == core::Entity::ImpulseInitiate) { diff --git a/src/game/intro/convoy.cc b/src/game/intro/convoy.cc index 226f8fa..c0fba52 100644 --- a/src/game/intro/convoy.cc +++ b/src/game/intro/convoy.cc @@ -16,7 +16,7 @@ Member::Member(std::string const &model) : core::EntityControlable(0, 1) set_name("Convoy member"); set_label(model); - entity_modelname = "ships/" + model; + set_modelname("ships/" + model); entity_thrust = 1.0f; /* diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc index 55f038f..efb3b40 100644 --- a/src/game/intro/intro.cc +++ b/src/game/intro/intro.cc @@ -117,7 +117,7 @@ bool Intro::load_world() } else if (ini.got_key_float("rotationspeed", globe->entity_rotationspeed)) { continue; } else if (ini.got_key_bool("bright", b)) { - if (b) { globe->entity_flags |= core::Entity::Bright; } + if (b) { globe->set_flag(core::Entity::Bright); } } else if (ini.got_key()) { ini.unkown_key(); } -- cgit v1.2.3