X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator%2Fgamemode_cts.qc;h=21098a5e996f04ddf213b20bd2042d844226fd52;hp=bfddc30b01bbbc7439a2fb76ab793e0662db4e41;hb=f7b69c7bd1d05162b3c532422e3ce3013dc0f5f2;hpb=b9671f63469586007314131f3f53728795c035cd diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qc b/qcsrc/server/mutators/mutator/gamemode_cts.qc index bfddc30b01..21098a5e99 100644 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@ -1,50 +1,6 @@ #include "gamemode_cts.qh" #include -#ifndef GAMEMODE_CTS_H -#define GAMEMODE_CTS_H - -void cts_Initialize(); - -REGISTER_MUTATOR(cts, false) -{ - MUTATOR_ONADD - { - if (time > 1) // game loads at time 1 - error("This is a game type and it cannot be added at runtime."); - - g_race_qualifying = true; - independent_players = 1; - SetLimits(0, 0, autocvar_timelimit_override, -1); - - cts_Initialize(); - } - - MUTATOR_ONROLLBACK_OR_REMOVE - { - // we actually cannot roll back cts_Initialize here - // BUT: we don't need to! If this gets called, adding always - // succeeds. - } - - MUTATOR_ONREMOVE - { - LOG_INFO("This is a game type and it cannot be removed at runtime."); - return -1; - } - - return 0; -} - -// scores -const float ST_CTS_LAPS = 1; -const float SP_CTS_LAPS = 4; -const float SP_CTS_TIME = 5; -const float SP_CTS_FASTEST = 6; -#endif - -#ifdef IMPLEMENTATION - #include float autocvar_g_cts_finish_kill_delay; @@ -62,7 +18,7 @@ void havocbot_role_cts(entity this) this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; navigation_goalrating_start(this); - FOREACH_ENTITY_CLASS("trigger_race_checkpoint", true, + IL_EACH(g_racecheckpoints, true, { if(it.cnt == this.race_checkpoint) navigation_routerating(this, it, 1000000, 5000); @@ -79,13 +35,13 @@ void cts_ScoreRules() ScoreRules_basics(0, 0, 0, false); if(g_race_qualifying) { - ScoreInfo_SetLabel_PlayerScore(SP_CTS_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME); + ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME); } else { - ScoreInfo_SetLabel_PlayerScore(SP_CTS_LAPS, "laps", SFL_SORT_PRIO_PRIMARY); - ScoreInfo_SetLabel_PlayerScore(SP_CTS_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME); - ScoreInfo_SetLabel_PlayerScore(SP_CTS_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME); + ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY); + ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME); + ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME); } ScoreRules_basics_end(); } @@ -111,8 +67,9 @@ void CTS_ClientKill(entity e) // silent version of ClientKill, used when player MUTATOR_HOOKFUNCTION(cts, PlayerPhysics) { entity player = M_ARGV(0, entity); + float dt = M_ARGV(1, float); - player.race_movetime_frac += PHYS_INPUT_TIMELENGTH; + player.race_movetime_frac += dt; float f = floor(player.race_movetime_frac); player.race_movetime_frac -= f; player.race_movetime_count += f; @@ -127,7 +84,7 @@ MUTATOR_HOOKFUNCTION(cts, PlayerPhysics) if(player.race_penalty) { player.velocity = '0 0 0'; - player.movetype = MOVETYPE_NONE; + set_movetype(player, MOVETYPE_NONE); player.disableclientprediction = 2; } } @@ -285,7 +242,7 @@ MUTATOR_HOOKFUNCTION(cts, PutClientInServer) MUTATOR_HOOKFUNCTION(cts, PlayerDies) { entity frag_target = M_ARGV(2, entity); - + frag_target.respawn_flags |= RESPAWN_FORCE; race_AbandonRaceCheck(frag_target); } @@ -355,7 +312,7 @@ MUTATOR_HOOKFUNCTION(cts, FilterItem) return true; } -MUTATOR_HOOKFUNCTION(cts, PlayerDamage_Calculate) +MUTATOR_HOOKFUNCTION(cts, Damage_Calculate) { entity frag_attacker = M_ARGV(1, entity); entity frag_target = M_ARGV(2, entity); @@ -406,7 +363,7 @@ MUTATOR_HOOKFUNCTION(cts, ClientKill) if(player.killindicator && player.killindicator.health == 1) // player.killindicator.health == 1 means that the kill indicator was spawned by CTS_ClientKill { - remove(player.killindicator); + delete(player.killindicator); player.killindicator = NULL; ClientKill_Now(player); // allow instant kill in this case @@ -440,5 +397,3 @@ void cts_Initialize() { cts_ScoreRules(); } - -#endif