- 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 '^:'
-Tue Jun 19 07:24:24 CEST 2018
+Wed Jun 20 07:24:25 CEST 2018
# 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"
{
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;
}
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)) {
// if(pointcontents(midpoint + '0 0 2') == CONTENT_WATER)
// { this.velocity_z = 70; }
}
- goto end;
+ sys_phys_postupdate(this);
+ return;
}
PM_check_slick(this);
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; }
{
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;
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)
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.
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;
// 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)