X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Fkeyhunt%2Fsv_keyhunt.qc;h=eaed7508981f2598b05ee4792276e9f4d63cd917;hb=0ade80044244ecfd180e7a3dfc0113dcf3a26572;hp=5d52ed7cb0379916ea8841585c46c04f71718dfa;hpb=d464b8e24227e71a33447c76220f5bf169047154;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc index 5d52ed7cb..eaed75089 100644 --- a/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc +++ b/qcsrc/common/gamemodes/gamemode/keyhunt/sv_keyhunt.qc @@ -1,5 +1,11 @@ #include "sv_keyhunt.qh" +#include +#include +#include +#include +#include + float autocvar_g_balance_keyhunt_damageforcescale; float autocvar_g_balance_keyhunt_delay_collect; float autocvar_g_balance_keyhunt_delay_damage_return; @@ -125,12 +131,12 @@ void kh_update_state() 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"); } @@ -577,7 +583,7 @@ void kh_LoserTeam(int loser_team, entity lostkey) // runs when a player pushes { if(lostkey.kh_previous_owner) kh_Scores_Event(lostkey.kh_previous_owner, NULL, "pushed", 0, -autocvar_g_balance_keyhunt_score_push); - // don't actually GIVE him the -nn points, just log + // don't actually GIVE them the -nn points, just log kh_Scores_Event(attacker, NULL, "push", autocvar_g_balance_keyhunt_score_push, 0); GameRules_scoring_add(attacker, KH_PUSHES, 1); //centerprint(attacker, "Your push is the best!"); // does this really need to exist? @@ -597,7 +603,7 @@ void kh_LoserTeam(int loser_team, entity lostkey) // runs when a player pushes if(lostkey.kh_previous_owner) kh_Scores_Event(lostkey.kh_previous_owner, NULL, "destroyed", 0, -autocvar_g_balance_keyhunt_score_destroyed); - // don't actually GIVE him the -nn points, just log + // don't actually GIVE them the -nn points, just log if(lostkey.kh_previous_owner.playerid == lostkey.kh_previous_owner_playerid) GameRules_scoring_add(lostkey.kh_previous_owner, KH_DESTROYS, 1); @@ -711,16 +717,13 @@ void key_reset(entity this) 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; @@ -851,7 +854,7 @@ int kh_GetMissingTeams() ++players; }); if (!players) - missing_teams |= (2 ** i); + missing_teams |= BIT(i); } return missing_teams; } @@ -977,7 +980,7 @@ void kh_Initialize() // sets up th KH environment 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); @@ -1257,14 +1260,6 @@ MUTATOR_HOOKFUNCTION(kh, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE) 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);