]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix some issues with LMS & CA
authorMario <mario.mario@y7mail.com>
Wed, 8 May 2013 04:20:26 +0000 (14:20 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 8 May 2013 04:20:26 +0000 (14:20 +1000)
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_lms.qc
qcsrc/server/mutators/gamemode_lms.qh

index 3d89301844c248c20f59dd3003e2f3dd434a337e..641482155d38eac1b99a9a4c07e80b0bd04cb812 100644 (file)
@@ -385,15 +385,7 @@ void PutObserverInServer (void)
                WriteEntity(MSG_ONE, self);
        }
 
-       if(g_lms)
-       {
-               // Only if the player cannot play at all
-               if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666)
-                       self.frags = FRAGS_SPECTATOR;
-               else
-                       self.frags = FRAGS_LMS_LOSER;
-       }
-       else if((g_race && g_race_qualifying) || g_cts)
+       if((g_race && g_race_qualifying) || g_cts)
        {
                if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
                        self.frags = FRAGS_LMS_LOSER;
@@ -610,14 +602,6 @@ void PutClientInServer (void)
        // reset player keys
        self.itemkeys = 0;
 
-       // player is dead and becomes observer
-       // FIXME fix LMS scoring for new system
-       if(g_lms)
-       {
-               if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
-                       self.classname = "observer";
-       }
-
        MUTATOR_CALLHOOK(PutClientInServer);
 
        if(gameover)
@@ -800,8 +784,6 @@ void PutClientInServer (void)
                self.colormod = '1 1 1' * autocvar_g_player_brightness;
                self.exteriorweaponentity.alpha = default_weapon_alpha;
 
-               self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
-               self.lms_traveled_distance = 0;
                self.speedrunning = FALSE;
 
                race_PostSpawn(spot);
index 95aeced31b308b5db10fa4ab9da332baab5151aa..60df5dd314a21d7008cd1232731a006dadffada3 100644 (file)
@@ -664,7 +664,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                else
                        self.respawn_countdown = -1; // do not count down
 
-               if(g_lms || g_cts || autocvar_g_forced_respawn)
+               if(g_cts || autocvar_g_forced_respawn)
                        self.respawn_flags = self.respawn_flags | RESPAWN_FORCE;
 
                self.death_time = time;
index 3e564e39ae93f055226d64ad8e3caf5b40e13fe0..e34464f16cbc84a102bfc9de9367ec8fb1a5c967 100644 (file)
@@ -332,9 +332,6 @@ void reset_map(float dorespawn)
                race_ReadyRestart();
        else MUTATOR_CALLHOOK(reset_map_global);
 
-       lms_lowest_lives = 999;
-       lms_next_place = player_count;
-
        for(self = world; (self = nextent(self)); )
        if(clienttype(self) == CLIENTTYPE_NOTACLIENT)
        {
@@ -379,8 +376,6 @@ void reset_map(float dorespawn)
                        //NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
                        if (IS_PLAYER(self)) {
                                //PlayerScore_Clear(self);
-                               if(g_lms)
-                                       PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
                                self.killcount = 0;
                                //stop the player from moving so that he stands still once he gets respawned
                                self.velocity = '0 0 0';
index fb93b7c7876b3d133d4f5b30b2daa872b56e4aa8..95dbe48ff3f4e24423ffeabff3d2e27bd9340bb7 100644 (file)
@@ -243,9 +243,6 @@ float nJoinAllowed(entity ignore);
 
 .float spawnshieldtime;
 
-.float lms_nextcheck;
-.float lms_traveled_distance;
-
 .entity flagcarried;
 
 .float playerid;
index 13eb647dbdeb36d83aeebb371d88a44e4bcef1f4..191bfaede12087b766569d7c665e5ebfd60827a5 100644 (file)
@@ -828,8 +828,7 @@ void readplayerstartcvars()
                g_pinata = 0; // incompatible
                g_weapon_stay = 0; // incompatible
                WEPSET_COPY_AA(start_weapons, g_weaponarena_weapons);
-               if(!g_ca)
-                       start_items |= IT_UNLIMITED_AMMO;
+               start_items |= IT_UNLIMITED_AMMO;
        }
        else if (g_minstagib)
        {
@@ -881,28 +880,11 @@ void readplayerstartcvars()
        }
        else
        {
-               if(g_ca)
-               {
-                       start_ammo_shells = cvar("g_lms_start_ammo_shells");
-                       start_ammo_nails = cvar("g_lms_start_ammo_nails");
-                       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
-                       start_ammo_cells = cvar("g_lms_start_ammo_cells");
-                       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
-               }
-               else
-               {
-                       start_ammo_shells = cvar("g_start_ammo_shells");
-                       start_ammo_nails = cvar("g_start_ammo_nails");
-                       start_ammo_rockets = cvar("g_start_ammo_rockets");
-                       start_ammo_cells = cvar("g_start_ammo_cells");
-                       start_ammo_fuel = cvar("g_start_ammo_fuel");
-               }
-       }
-
-       if (g_ca)
-       {
-               start_health = cvar("g_lms_start_health");
-               start_armorvalue = cvar("g_lms_start_armor");
+               start_ammo_shells = cvar("g_start_ammo_shells");
+               start_ammo_nails = cvar("g_start_ammo_nails");
+               start_ammo_rockets = cvar("g_start_ammo_rockets");
+               start_ammo_cells = cvar("g_start_ammo_cells");
+               start_ammo_fuel = cvar("g_start_ammo_fuel");
        }
 
        if (inWarmupStage)
index 11330fbd7d6b370f851aa8425bd11d0dfab4322d..22bfc981c34c6cff8013f384f73641c698343f90 100644 (file)
@@ -222,6 +222,22 @@ MUTATOR_HOOKFUNCTION(ca_GiveFragsForKill)
        return 1;
 }
 
+MUTATOR_HOOKFUNCTION(ca_SetStartItems)
+{
+       start_health = cvar("g_lms_start_health");
+       start_armorvalue = cvar("g_lms_start_armor");
+       
+       start_ammo_shells = cvar("g_lms_start_ammo_shells");
+       start_ammo_nails = cvar("g_lms_start_ammo_nails");
+       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+       start_ammo_cells = cvar("g_lms_start_ammo_cells");
+       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
+       
+       start_items &~= IT_UNLIMITED_AMMO;
+
+       return 0;
+}
+
 void ca_Initialize()
 {
        allowed_to_spawn = TRUE;
@@ -248,6 +264,7 @@ MUTATOR_DEFINITION(gamemode_ca)
        MUTATOR_HOOK(ForbidPlayerScore_Clear, ca_ForbidPlayerScore_Clear, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidThrowCurrentWeapon, ca_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
        MUTATOR_HOOK(GiveFragsForKill, ca_GiveFragsForKill, CBC_ORDER_FIRST);
+       MUTATOR_HOOK(SetStartItems, ca_SetStartItems, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 681a1d433a1f62dbc0cfe4b60b7d05b71850b704..82258ac77c115e33d144c7dc280526c0c3aa729c 100644 (file)
@@ -18,15 +18,49 @@ float LMS_NewPlayerLives()
 }
 
 // mutator hooks
-MUTATOR_HOOKFUNCTION(lms_PlayerSpawn)
+MUTATOR_HOOKFUNCTION(lms_ResetMap)
+{
+       lms_lowest_lives = 999;
+       lms_next_place = player_count;
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_ResetPlayers)
 {
-       if(IS_PLAYER(self))
        if(restart_mapalreadyrestarted || (time < game_starttime))
+       FOR_EACH_CLIENT(self)
+       if(IS_PLAYER(self))
                PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn)
+{
+       // player is dead and becomes observer
+       // FIXME fix LMS scoring for new system
+       if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
+               self.classname = "observer";
+
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_PlayerSpawn)
+{
+       self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
+       self.lms_traveled_distance = 0;
                
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(lms_PlayerDies)
+{
+       self.respawn_flags |= RESPAWN_FORCE;
+       
+       return FALSE;
+}
+
 MUTATOR_HOOKFUNCTION(lms_RemovePlayer)
 {
        // Only if the player cannot play at all
@@ -181,18 +215,6 @@ MUTATOR_HOOKFUNCTION(lms_ItemTouch)
        return FALSE;
 }
 
-MUTATOR_HOOKFUNCTION(lms_BotSpawn)
-{
-       // temporary hack to give bots lives
-       if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
-       {
-               PlayerScore_Add(self, SP_LMS_RANK, 666);
-               self.frags = FRAGS_SPECTATOR;
-       }
-       
-       return FALSE;
-}
-
 // scoreboard stuff
 void lms_ScoreRules()
 {
@@ -212,7 +234,11 @@ void lms_Initialize()
 
 MUTATOR_DEFINITION(gamemode_lms)
 {
+       MUTATOR_HOOK(reset_map_global, lms_ResetMap, CBC_ORDER_ANY);
+       MUTATOR_HOOK(reset_map_players, lms_ResetPlayers, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PutClientInServer, lms_PlayerPreSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerSpawn, lms_PlayerSpawn, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDies, lms_PlayerDies, CBC_ORDER_ANY);
        MUTATOR_HOOK(MakePlayerObserver, lms_RemovePlayer, CBC_ORDER_ANY);
        MUTATOR_HOOK(ClientConnect, lms_ClientConnect, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPreThink, lms_PlayerThink, CBC_ORDER_ANY);
@@ -223,7 +249,6 @@ MUTATOR_DEFINITION(gamemode_lms)
        MUTATOR_HOOK(ForbidPlayerScore_Clear, lms_KeepScore, CBC_ORDER_ANY);
        MUTATOR_HOOK(FilterItem, lms_FilterItem, CBC_ORDER_ANY);
        MUTATOR_HOOK(ItemTouch, lms_ItemTouch, CBC_ORDER_ANY);
-       MUTATOR_HOOK(HavocBot_ChooseRule, lms_BotSpawn, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 16fda61550823e6a098e27a2f47e1cfe2506550d..508bf8c6cd12b98af08be540322c31a346adea79 100644 (file)
@@ -5,4 +5,8 @@
 // lives related defs
 float lms_lowest_lives;
 float lms_next_place;
-float LMS_NewPlayerLives();
\ No newline at end of file
+float LMS_NewPlayerLives();
+
+// camp check
+.float lms_nextcheck;
+.float lms_traveled_distance;
\ No newline at end of file