#include "sv_keyhunt.qh"
+#include <server/command/vote.qh>
+#include <server/gamelog.qh>
+#include <server/damage.qh>
+#include <server/items/items.qh>
+#include <common/mapobjects/triggers.qh>
+
float autocvar_g_balance_keyhunt_damageforcescale;
float autocvar_g_balance_keyhunt_delay_collect;
float autocvar_g_balance_keyhunt_delay_damage_return;
s |= (32 ** key.count) * f;
}
- FOREACH_CLIENT(true, { STAT(KH_KEYS, it) = s; });
+ FOREACH_CLIENT(true, { STAT(OBJECTIVE_STATUS, it) = s; });
FOR_EACH_KH_KEY(key)
{
if(key.owner)
- STAT(KH_KEYS, key.owner) |= (32 ** key.count) * 31;
+ STAT(OBJECTIVE_STATUS, key.owner) |= (32 ** key.count) * 31;
}
//print(ftos((nextent(NULL)).kh_state), "\n");
}
midpoint += thisorigin;
if(!first)
- te_lightning2(NULL, lastorigin, thisorigin);
+ {
+ // TODO: this effect has been replaced due to a possible crash it causes
+ // see https://gitlab.com/xonotic/darkplaces/issues/123
+ //te_lightning2(NULL, lastorigin, thisorigin);
+ Send_Effect(EFFECT_TR_NEXUIZPLASMA, lastorigin, thisorigin, 1);
+ }
lastorigin = thisorigin;
if(first)
firstorigin = thisorigin;
}
if(NumTeams(kh_teams) > 2)
{
- te_lightning2(NULL, lastorigin, firstorigin);
+ //te_lightning2(NULL, lastorigin, firstorigin); // TODO see above
+ Send_Effect(EFFECT_TR_NEXUIZPLASMA, lastorigin, firstorigin, 1);
}
midpoint = midpoint * (1 / NumTeams(kh_teams));
te_customflash(midpoint, 1000, 1, Team_ColorRGB(winner_team) * 0.5 + '0.5 0.5 0.5'); // make the color >=0.5 in each component
kh_Key_Remove(this);
}
-const string STR_ITEM_KH_KEY = "item_kh_key";
void kh_Key_Spawn(entity initial_owner, float _angle, float i) // runs every time a new flag is created, ie after all the keys have been collected
{
- entity key = spawn();
+ entity key = new(item_kh_key);
key.count = i;
- key.classname = STR_ITEM_KH_KEY;
settouch(key, kh_Key_Touch);
setthink(key, kh_Key_Think);
key.nextthink = time;
- key.items = IT_KEY1 | IT_KEY2;
key.cnt = _angle;
key.angles = '0 360 0' * random();
key.event_damage = kh_Key_Damage;
++players;
});
if (!players)
- missing_teams |= (2 ** i);
+ missing_teams |= BIT(i);
}
return missing_teams;
}
kh_teams = BITS(bound(2, kh_teams, 4));
// make a KH entity for controlling the game
- kh_controller = spawn();
+ kh_controller = new_pure(kh_controller);
setthink(kh_controller, kh_Controller_Think);
kh_Controller_SetThink(0, kh_WaitForPlayers);
return true;
}
-MUTATOR_HOOKFUNCTION(kh, SpectateCopy)
-{
- entity spectatee = M_ARGV(0, entity);
- entity client = M_ARGV(1, entity);
-
- STAT(KH_KEYS, client) = STAT(KH_KEYS, spectatee);
-}
-
MUTATOR_HOOKFUNCTION(kh, PlayerUseKey)
{
entity player = M_ARGV(0, entity);