Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2013-10-13 18:29:00 +0000
committerStijn Buys <ingar@osirion.org>2013-10-13 18:29:00 +0000
commit6e140025aab2c57b400c54a06b811875c196cede (patch)
treed8cd92201243a9b8751a3cc135d9065b8e48648f /src/game/base/game.cc
parentadc3d4dbff2361da2ba9a8e0e0207546d474e29a (diff)
Added initial NPC class, added 'wingmen' engine function.
Diffstat (limited to 'src/game/base/game.cc')
-rw-r--r--src/game/base/game.cc42
1 files changed, 37 insertions, 5 deletions
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index 2b605a4..aa7fd07 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -9,6 +9,8 @@
#include <iomanip>
#include <assert.h>
+#include "math/mathlib.h"
+#include "sys/sys.h"
#include "auxiliary/functions.h"
#include "core/gameserver.h"
#include "core/parser.h"
@@ -22,6 +24,7 @@
#include "base/faction.h"
#include "base/navpoint.h"
#include "base/jumppoint.h"
+#include "base/npc.h"
#include "base/planet.h"
#include "base/savegame.h"
#include "base/spacemine.h"
@@ -31,8 +34,6 @@
#include "base/star.h"
#include "base/template.h"
#include "base/weapon.h"
-#include "math/mathlib.h"
-#include "sys/sys.h"
namespace game
{
@@ -557,6 +558,34 @@ void Game::func_give(core::Player *player, const std::string &args)
}
}
+// cheats
+void Game::func_wingmen(core::Player *player, const std::string &args)
+{
+ if (!Game::g_devel->value()) {
+ player->send("Cheats disabled");
+ return;
+ }
+
+ if (!player->control()) {
+ player->send("^WYou need to join the game first!");
+ return;
+ }
+
+ if (player->control()->moduletype() != ship_enttype)
+ return;
+
+ Ship * ship = static_cast<Ship *>(player->control());
+
+ std::istringstream is(args);
+ std::string str;
+
+ is >> str;
+ aux::to_label(str);
+
+ if (str.compare("add") == 0) {
+ NPC::add_wingman(ship);
+ }
+}
void Game::func_specs(core::Player *player, const std::string &args)
{
@@ -1038,7 +1067,7 @@ void Game::func_drop(core::Player *player, const std::string &args)
spacemine->set_color(ship->color());
spacemine->set_owner_id(player->id());
spacemine->set_color_second(ship->color_second());
- spacemine->set_location(ship->location() + ship->axis().forward() * -1.0f * (ship->radius() + spacemine->radius()));
+ spacemine->set_location(ship->location() - ship->axis().forward() * (ship->radius() + spacemine->radius()));
spacemine->set_axis(ship->axis());
spacemine->set_zone(ship->zone());
@@ -1589,7 +1618,10 @@ Game::Game() : core::Module("Project::OSiRiON", true)
func->set_info("beam nearby cargo pods in");
func = core::Func::add("give", Game::func_give);
- func->set_info("cheat functions");
+ func->set_info("cheat function to get items and ships");
+
+ func = core::Func::add("wingmen", Game::func_wingmen);
+ func->set_info("cheat function for wingmen control");
func = core::Func::add("specs", Game::func_specs);
func->set_info("change your current ship's engine specifications");
@@ -1598,7 +1630,7 @@ Game::Game() : core::Module("Project::OSiRiON", true)
func->set_info("[string] activate or deactivate hyperspace jump drive");
func = core::Func::add("impulse", Game::func_impulse);
- func->set_info("activate are deactive kinetic impulse drive");
+ func->set_info("toggle kinetic impulse drive");
func = core::Func::add("launch", Game::func_launch);
func->set_info("launch to space when docked");