From: Javier Sancho Date: Mon, 19 Feb 2018 15:46:20 +0000 (+0100) Subject: New non-atacking player X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=29b23632dbddbb74ca9c74e3229c5e4729fe3622;p=lugaru.git New non-atacking player --- diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 1a22117..ed1aed9 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1472,6 +1472,9 @@ void Game::ProcessDevInput() Person::players.back()->power = Person::players[0]->power; Person::players.back()->speedmult = Person::players[0]->speedmult; + if (Input::isKeyDown(SDL_SCANCODE_RSHIFT)) + Person::players.back()->isplayerfriend = true; + Person::players.back()->loaded = true; } diff --git a/Source/Objects/Person.cpp b/Source/Objects/Person.cpp index d0e8f08..8022c0f 100644 --- a/Source/Objects/Person.cpp +++ b/Source/Objects/Person.cpp @@ -169,6 +169,7 @@ Person::Person() victim(nullptr) , hasvictim(false) + , isplayerfriend(false) , updatedelay(0) @@ -7324,7 +7325,7 @@ bool Person::addClothes(const int& clothesId) void Person::doAI() { - if (!isPlayerControlled() && !Dialog::inDialog()) { + if (!isPlayerControlled() && !isPlayerFriend() && !Dialog::inDialog()) { jumpclimb = 0; //disable movement in editor if (Game::editorenabled) { diff --git a/Source/Objects/Person.hpp b/Source/Objects/Person.hpp index 89d5b40..22c76eb 100644 --- a/Source/Objects/Person.hpp +++ b/Source/Objects/Person.hpp @@ -157,6 +157,7 @@ public: std::shared_ptr victim; bool hasvictim; + bool isplayerfriend; float updatedelay; float normalsupdatedelay; @@ -405,6 +406,7 @@ public: bool hasWeapon() { return (weaponactive != -1); } bool isPlayerControlled() { return (aitype == playercontrolled); } + bool isPlayerFriend() { return isplayerfriend; } }; const int maxplayers = 10;