]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/monsters
authorMario <mario@smbclan.net>
Wed, 20 Jun 2018 13:17:13 +0000 (23:17 +1000)
committerMario <mario@smbclan.net>
Wed, 20 Jun 2018 13:17:13 +0000 (23:17 +1000)
.gitlab-ci.yml
.tx/merge-base
common.ko.po
qcsrc/common/t_items.qc
qcsrc/ecs/systems/physics.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/resources.qc
qcsrc/server/resources.qh
qcsrc/server/spawnpoints.qc

index 8243f0d9ba5af67ff036301b93dfb84e9510ca87..844e70c6ad615aa1b1d32b9cdcedf27b6b4cf924 100644 (file)
@@ -29,7 +29,7 @@ test_sv_game:
     - wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
     - wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
     - make
-    - EXPECT=de6a7d95ce65fb6c66558a93a9fb994f
+    - EXPECT=242ab47092837a05ba09f041b32bddb1
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index ca3e6259bf1e4c76f8dfb134c5470f593a42c203..ca7140deb4f39043ced90c760624d498c0f1b2a1 100644 (file)
@@ -1 +1 @@
-Tue Jun 19 07:24:24 CEST 2018
+Wed Jun 20 07:24:25 CEST 2018
index c313d80193d2ab682a8aaf27ff3e5e2f0beee0aa..4d65b27123a4b82371ab71c2651b0b7184ef1083 100644 (file)
@@ -7,6 +7,7 @@
 # Kyf Lee <coughingmouse@gmail.com>, 2016
 # Kyf Lee <coughingmouse@gmail.com>, 2016-2017
 # Kyf Lee <coughingmouse@gmail.com>, 2016-2017
+# Kyf Lee <coughingmouse@gmail.com>, 2016
 msgid ""
 msgstr ""
 "Project-Id-Version: Xonotic\n"
index 68fa7ef578ee302b29fd3697e22f89b5a2b6d856..140b619c5ec09cae3f8c62fcf1e87bb6c4b61c2b 100644 (file)
@@ -742,14 +742,14 @@ float Item_GiveAmmoTo(entity item, entity player, int resource_type, float ammom
                {
                        return false;
                }
-               GiveResourceWithLimit(player, resource_type, amount, ammomax);
+               GiveOrTakeResourceWithLimit(player, resource_type, amount, ammomax);
                return true;
        }
        if (g_weapon_stay != 2)
        {
                return false;
        }
-       GiveResourceWithLimit(player, resource_type, amount, min(amount, ammomax));
+       GiveOrTakeResourceWithLimit(player, resource_type, amount, min(amount, ammomax));
        return true;
 }
 
index 8896b5a442ba42d78c4420ee3c0332dacb2956c6..ae5f119e7fe8db0eea039a57032af553cd4d7d24 100644 (file)
@@ -6,6 +6,8 @@
 void sys_phys_simulate(entity this, float dt);
 void sys_phys_simulate_simple(entity this, float dt);
 
+void sys_phys_postupdate(entity this);
+
 void sys_phys_update(entity this, float dt)
 {
        if (!IS_CLIENT(this)) {
@@ -63,7 +65,8 @@ void sys_phys_update(entity this, float dt)
                        // if(pointcontents(midpoint + '0 0 2') == CONTENT_WATER)
                        // { this.velocity_z = 70; }
                }
-               goto end;
+               sys_phys_postupdate(this);
+               return;
        }
 
        PM_check_slick(this);
@@ -153,7 +156,11 @@ void sys_phys_update(entity this, float dt)
                this.com_phys_air = false;
        }
 
-       LABEL(end)
+       sys_phys_postupdate(this);
+}
+
+void sys_phys_postupdate(entity this)
+{
        if (IS_ONGROUND(this)) { this.lastground = time; }
 // conveyors: then break velocity again
        if (this.conveyor.active) { this.velocity += this.conveyor.movedir; }
index 512d3a2062b0049cc8295b892c518a4ec2fe7f78..555cfd0ef0a1f4da4beb81ebc73577ced6dd0360 100644 (file)
@@ -1234,12 +1234,13 @@ void navigation_routerating(entity this, entity e, float f, float rangebias)
                {
                        entity theEnemy = e;
                        entity best_wp = NULL;
-                       float best_dist = 10000;
-                       IL_EACH(g_waypoints, vdist(it.origin - theEnemy.origin, <, 500)
+                       float best_dist = FLOAT_MAX;
+                       IL_EACH(g_waypoints, !(it.wpflags & WAYPOINTFLAG_TELEPORT)
+                               && vdist(it.origin - theEnemy.origin, <, 500)
                                && vdist(it.origin - this.origin, >, 100)
-                               && !(it.wpflags & WAYPOINTFLAG_TELEPORT),
+                               && vdist(it.origin - this.origin, <, 10000),
                        {
-                               float dist = vlen(it.origin - theEnemy.origin);
+                               float dist = vlen2(it.origin - theEnemy.origin);
                                if (dist < best_dist)
                                {
                                        best_wp = it;
index b3b19095ae8b14e7832b386d1f5614c891a3d93f..74a0c55788a71a2f19de6accaeaacba47f1c9c3b 100644 (file)
@@ -232,13 +232,38 @@ void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
                return;
        }
        float current_amount = GetResourceAmount(receiver, resource_type);
-       if (current_amount - amount < limit)
+       if (current_amount - amount < -limit)
        {
-               amount = limit + current_amount;
+               amount = -limit + current_amount;
        }
        TakeResource(receiver, resource_type, amount);
 }
 
+void GiveOrTakeResource(entity receiver, int resource_type, float amount)
+{
+       if(amount < 0)
+       {
+               TakeResource(receiver, resource_type, amount * -1);
+       }
+       else
+       {
+               GiveResource(receiver, resource_type, amount);
+       }
+}
+
+void GiveOrTakeResourceWithLimit(entity receiver, int resource_type, float amount,
+       float limit)
+{
+       if(amount < 0)
+       {
+               TakeResourceWithLimit(receiver, resource_type, amount * -1, limit);
+       }
+       else
+       {
+               GiveResourceWithLimit(receiver, resource_type, amount, limit);
+       }
+}
+
 int GetResourceType(.float resource_field)
 {
        switch (resource_field)
index e4631ab5605ad30d7953826cdaddf6ef78ea7bd7..15433b264fde16ba7b34d98510743ead0accf3b8 100644 (file)
@@ -67,6 +67,22 @@ void TakeResource(entity receiver, int resource_type, float amount);
 void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
        float limit);
 
+/// \brief Gives to or takes from an entity resource.
+/// \param[in,out] receiver Entity to give or take resource.
+/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] amount Amount of resource to give or take.
+/// \return No return.
+void GiveOrTakeResource(entity receiver, int resource_type, float amount);
+
+/// \brief Gives to or takes from an entity resource but not more/less than a limit.
+/// \param[in,out] receiver Entity to give or take resource.
+/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] amount Amount of resource to give or take.
+/// \param[in] limit Limit of resources to give or take.
+/// \return No return.
+void GiveOrTakeResourceWithLimit(entity receiver, int resource_type, float amount,
+       float limit);
+
 // ===================== Legacy and/or internal API ===========================
 
 /// \brief Converts an entity field to resource type.
index dcf6016c5e326b902e8c59f06519ab86215ee707..e0e33e4803c87445641359a8c76824cc821a19a8 100644 (file)
@@ -327,14 +327,21 @@ SelectSpawnPoint
 Finds a point to respawn
 =============
 */
+bool testspawn_checked;
+entity testspawn_point;
 entity SelectSpawnPoint(entity this, bool anypoint)
 {
        float teamcheck;
-       entity spot, firstspot;
+       entity spot = NULL;
 
-       spot = find(NULL, classname, "testplayerstart");
-       if (spot)
-               return spot;
+       if(!testspawn_checked)
+       {
+               testspawn_point = find(NULL, classname, "testplayerstart");
+               testspawn_checked = true;
+       }
+
+       if(testspawn_point)
+               return testspawn_point;
 
        if(this.spawnpoint_targ)
                return this.spawnpoint_targ;
@@ -365,7 +372,16 @@ entity SelectSpawnPoint(entity this, bool anypoint)
 
 
        // get the entire list of spots
-       firstspot = findchain(classname, "info_player_deathmatch");
+       //entity firstspot = findchain(classname, "info_player_deathmatch");
+       entity firstspot = IL_FIRST(g_spawnpoints);
+       entity prev = NULL;
+       IL_EACH(g_spawnpoints, true,
+       {
+               if(prev)
+                       prev.chain = it;
+               it.chain = NULL;
+               prev = it;
+       });
        // filter out the bad ones
        // (note this returns the original list if none survived)
        if(anypoint)