]> git.jsancho.org Git - lugaru.git/commitdiff
New non-atacking player
authorJavier Sancho <jsf@jsancho.org>
Mon, 19 Feb 2018 15:46:20 +0000 (16:46 +0100)
committerJavier Sancho <jsf@jsancho.org>
Mon, 19 Feb 2018 15:46:20 +0000 (16:46 +0100)
Source/GameTick.cpp
Source/Objects/Person.cpp
Source/Objects/Person.hpp

index 1a22117142c4727a5902142b209fefe00f0a8a4b..ed1aed93a4c4ed8ff8a0652efbf8234c5120a20d 100644 (file)
@@ -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;
         }
 
index d0e8f083742ffd22baf8a5b7b864382d29f0af66..8022c0fc3323f023bc485bb3ff2eb20a7ae12ad9 100644 (file)
@@ -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) {
index 89d5b40277022d92e445c55449f42e86a08cbf0a..22c76eb17c4e82fd9038352c5e35ad2b022067b4 100644 (file)
@@ -157,6 +157,7 @@ public:
 
     std::shared_ptr<Person> 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;