]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add Corpse feature, fix round start when starts 1v1 Detective vs Traitor, converts...
authorLegendaryGuard <rootuser999@gmail.com>
Fri, 26 Feb 2021 20:48:14 +0000 (21:48 +0100)
committerLegendaryGuard <rootuser999@gmail.com>
Fri, 26 Feb 2021 20:48:14 +0000 (21:48 +0100)
gamemodes-server.cfg
qcsrc/common/gamemodes/gamemode/ttt/cl_ttt.qc
qcsrc/common/gamemodes/gamemode/ttt/sv_ttt.qc
qcsrc/common/gamemodes/gamemode/ttt/sv_ttt.qh

index c580e7a693431701bbb7ccbfdccad0c599e6f9d0..2e9f0e02d5d4960e297446ada8fa93b9ef20a485 100644 (file)
@@ -573,8 +573,9 @@ set g_duel_not_dm_maps 0 "when this is set, DM maps will NOT be listed in duel"
 set g_ttt 0 "Trouble in Terrorist Town: A group of space terrorists have traitors among them. Traitors must kill terrorists, while the terrorists have to try to find and kill the traitors"
 set g_ttt_not_lms_maps 0 "when this is set, LMS maps will NOT be listed in ttt"
 set g_ttt_traitor_count 0.25 "number of players who will become traitors, set between 0 and 0.9 to use a multiplier of the current players, or 1 and above to specify an exact number of players"
-set g_ttt_detective_count 0.125 "number of players who will become detectives, set between 0 and 0.9 to use a multiplier of the current players, or 1 and above to specify an exact number of players"
-set g_ttt_punish_teamkill 1 "kill the player when they kill an ally"
+set g_ttt_punish_teamkill 0 "kill the player when they kill an ally"
 set g_ttt_reward_innocent 1 "give a point to all innocent players if the round timelimit is reached, in addition to the points given for kills"
 set g_ttt_warmup 10 "how long the players will have time to run around the map before the round starts"
-set g_ttt_round_timelimit 180 "round time limit in seconds"
\ No newline at end of file
+set g_ttt_round_timelimit 180 "round time limit in seconds"
+set g_ttt_max_karma_points 1000 "limit of maximum number of karma points will have in the server"
+set g_ttt_min_karma_points 400 "limit where number of karma points can be reached when are being decreased"
\ No newline at end of file
index 1583345bd79b00c0676406bd0d2263b9fadf0afe..8820cf1e129d9dd0fd270c543acf79783a626879 100644 (file)
@@ -91,7 +91,7 @@ MUTATOR_HOOKFUNCTION(cl_ttt, ForcePlayercolors_Skip, CBC_ORDER_LAST)
        {
                plcolor = TTT_COLOR_DETECTIVE;
        }
-       
+
        player.colormap = 1024 + plcolor;
        return true;
 }
index f7db8d6276574dda8793c9d4b04a2accaf32981f..4dd70e476966793fde53deaef8037ae16f9f7b0a 100644 (file)
@@ -1,19 +1,19 @@
 #include "sv_ttt.qh"
 
-float autocvar_g_ttt_detective_count = 0.125;
+//set g_ttt_detective_count 0.125 "number of players who will become detectives, set between 0 and 0.9 to use a multiplier of the current players, or 1 and above to specify an exact number of players"
+//float autocvar_g_ttt_detective_count = 0.125; //I don't think that it won't be used...
+float autocvar_g_ttt_innocent_count = 0.625;
 float autocvar_g_ttt_traitor_count = 0.25;
 float autocvar_g_ttt_round_timelimit = 180;
 float autocvar_g_ttt_warmup = 10;
-bool autocvar_g_ttt_punish_teamkill = false;
+bool autocvar_g_ttt_punish_teamkill = 0; //false by default
 bool autocvar_g_ttt_reward_innocent = true;
 float autocvar_g_ttt_max_karma_points = 1000; //LegendGuard sets Karma points 21-02-2021
-float autocvar_g_ttt_min_karma_points = 200;
-//TODO: when finished new cvars, add them to gamemodes-server.cfg 22-02-2021
+float autocvar_g_ttt_min_karma_points = 400;
 
 //TODO: add Detective and corpse function if a player is DEAD
 
-//TOFIX: Problems: Detective is a created team, this team is added inside Innocents team
-// when there's a detective and a traitor and no innocent in the round, round ends.
+//TODO: Problems: Detective is a created team, this team is added inside Innocents team
 // detective shouldn't be attacked by innocent bots.
 // detective should detect the point of the corpses (new function).
 
@@ -46,65 +46,64 @@ void ttt_UpdateScores(bool timed_out)
                {
                        GameRules_scoring_add(it, SCORE, it.ttt_validkills);
                }
-               //LOG_INFOF("^3it.karmapoints^7: ^8%f", it.karmapoints);
                it.ttt_validkills = 0;
                // player survived the round
-               if(IS_PLAYER(it) && !IS_DEAD(it)) //TODO: LegendGuard, add something for Karma if possible 21-02-2021
+               if(IS_PLAYER(it) && !IS_DEAD(it)) // LegendGuard adds something for Karma 21-02-2021
                {
                        //TODO: Detective doesn't need scores, but if investigated a corpse maybe yes 22-02-2021
                        if(autocvar_g_ttt_reward_innocent && timed_out && it.ttt_status == TTT_STATUS_INNOCENT && it.ttt_status == TTT_STATUS_DETECTIVE)
                        {
                                GameRules_scoring_add(it, SCORE, 1); // reward innocents who make it to the end of the round time limit
-                               float increasekarma = 25; //25 points lol  //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
-                               PrintToChatAll(sprintf("^2REWARD ^7increasekarma: ^2%f", increasekarma));
+                               float increasekarma = 15; //15 points lol  //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
+                               //PrintToChatAll(sprintf("^2REWARD ^7increasekarma: ^2%f", increasekarma));
                                GameRules_scoring_add(it, TTT_KARMA, increasekarma);
                                it.karmapoints = it.karmapoints + increasekarma;
-                               PrintToChatAll(sprintf("^2REWARD ^7it.karmapoints: ^1%f", it.karmapoints));
+                               //PrintToChatAll(sprintf("^2REWARD ^7it.karmapoints: ^1%f", it.karmapoints));
                                if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
                                {
-                                       //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
-                                       PrintToChatAll("^3REWARD ^1MAXIMUM RESET");
+                                       //Resets karmapoints to maintain the maximum
+                                       //PrintToChatAll("^3REWARD ^1MAXIMUM RESET");
                                        GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
                                        it.karmapoints = autocvar_g_ttt_max_karma_points;
                                }
                                else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
-                                       PrintToChatAll("kick kick kick GET OUT!!");
+                                       dropclient(it); //PrintToChatAll("GET OUT!!");
                        }
                        if(it.ttt_status == TTT_STATUS_INNOCENT)
                        {
                                GameRules_scoring_add(it, TTT_RESISTS, 1);
-                               float increasekarma = 50; //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
-                               PrintToChatAll(sprintf("^2INNOCENT ^7increasekarma: ^2%f", increasekarma));
+                               float increasekarma = 35; //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
+                               //PrintToChatAll(sprintf("^2INNOCENT ^7increasekarma: ^2%f", increasekarma));
                                GameRules_scoring_add(it, TTT_KARMA, increasekarma);
                                it.karmapoints = it.karmapoints + increasekarma;
-                               PrintToChatAll(sprintf("^2INNOCENT ^7it.karmapoints: ^1%f", it.karmapoints));
+                               //PrintToChatAll(sprintf("^2INNOCENT ^7it.karmapoints: ^1%f", it.karmapoints));
                                if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
                                {
-                                       //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
+                                       //Resets karmapoints to maintain the maximum
                                        //PrintToChatAll("^3INNOCENT ^1MAXIMUM RESET");
                                        GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
                                        it.karmapoints = autocvar_g_ttt_max_karma_points;
                                }
                                else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
-                                       PrintToChatAll("kick kick kick GET OUT!!");
+                                       dropclient(it); //PrintToChatAll("GET OUT!!");
                        }
                        else if(it.ttt_status == TTT_STATUS_TRAITOR)
                        {
                                GameRules_scoring_add(it, TTT_HUNTS, 1);
-                               float increasekarma = 50; //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
-                               PrintToChatAll(sprintf("^1TRAITOR ^7increasekarma: ^2%f", increasekarma));
+                               float increasekarma = 35; //autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) );
+                               //PrintToChatAll(sprintf("^1TRAITOR ^7increasekarma: ^2%f", increasekarma));
                                GameRules_scoring_add(it, TTT_KARMA, increasekarma);
                                it.karmapoints = it.karmapoints + increasekarma;
-                               PrintToChatAll(sprintf("^1TRAITOR ^7it.karmapoints: ^1%f", it.karmapoints));
+                               //PrintToChatAll(sprintf("^1TRAITOR ^7it.karmapoints: ^1%f", it.karmapoints));
                                if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
                                {
                                        //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
-                                       PrintToChatAll("^3TRAITOR ^1MAXIMUM RESET");
+                                       //PrintToChatAll("^3TRAITOR ^1MAXIMUM RESET");
                                        GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
                                        it.karmapoints = autocvar_g_ttt_max_karma_points;
                                }
                                else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
-                                       PrintToChatAll("kick kick kick GET OUT!!");
+                                       dropclient(it); //PrintToChatAll("GET OUT!!");
                        }
                }
        });
@@ -157,7 +156,7 @@ float ttt_CheckWinner()
                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_TTT_INNOCENT_WIN);
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_TTT_INNOCENT_WIN);
        }
-       else if (detective_count > 0) // detectives are same as innocents win
+       else if (detective_count > 0 && innocent_count > 0) // detectives are same as innocents win
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_TTT_INNOCENT_WIN);
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_TTT_INNOCENT_WIN);
@@ -177,7 +176,11 @@ float ttt_CheckWinner()
        FOREACH_CLIENT(true,
        {
                if(IS_PLAYER(it))
+               {
+                       it.respawn_flags = RESPAWN_SILENT; //CSQC print output respawn lib.qh error fix
+                       it.damagedbycontents = true;
                        nades_Clear(it);
+               }
                ttt_FakeTimeLimit(it, -1);
        });
 
@@ -188,6 +191,8 @@ void ttt_RoundStart()
 {
        allowed_to_spawn = boolean(warmup_stage);
        int playercount = 0;
+
+       // Fix number of detectives to 1
        FOREACH_CLIENT(true,
        {
                if(IS_PLAYER(it) && !IS_DEAD(it))
@@ -200,8 +205,49 @@ void ttt_RoundStart()
                it.ttt_validkills = 0;
        });
        
+       int innocent_count = bound(1, ((autocvar_g_ttt_innocent_count >= 1) ? autocvar_g_ttt_innocent_count : floor(playercount * autocvar_g_ttt_innocent_count)), playercount - 1); // 20%, but ensure at least 1 and less than total
+       int total_innocents = 0;
        int traitor_count = bound(1, ((autocvar_g_ttt_traitor_count >= 1) ? autocvar_g_ttt_traitor_count : floor(playercount * autocvar_g_ttt_traitor_count)), playercount - 1); // 20%, but ensure at least 1 and less than total
        int total_traitors = 0;
+       //int detective_count = bound(1, ((autocvar_g_ttt_detective_count >= 1) ? autocvar_g_ttt_detective_count : floor(playercount * autocvar_g_ttt_detective_count)), playercount - 1); // 20%, but ensure at least 1 and less than total
+       int total_detectives = 0;
+       //innocents TOTAL
+       FOREACH_CLIENT_RANDOM(IS_PLAYER(it) && !IS_DEAD(it),
+       {
+               if(total_innocents >= innocent_count)
+                       break;
+               total_innocents++;
+               //LegendGuard fixes the round start 26-02-2021
+               if (total_innocents <= 1)
+               {
+                       if (total_traitors <= 1)
+                               it.ttt_status = TTT_STATUS_TRAITOR;
+               }
+               else if (total_innocents == 3) // test this? && total_traitors >= 1)
+               {
+                       if (total_detectives >= 1)
+                               break;
+                       else
+                       {
+                               total_detectives++;
+                               it.ttt_status = TTT_STATUS_DETECTIVE;
+                       }
+               }
+               else if (total_innocents >= 5)
+               {
+                       if (total_detectives >= 2)
+                               break;
+                       else
+                       {
+                               total_detectives++;
+                               it.ttt_status = TTT_STATUS_DETECTIVE;
+                       }
+               }
+               else
+                       it.ttt_status = TTT_STATUS_INNOCENT;
+       });
+       
+       //traitors TOTAL
        FOREACH_CLIENT_RANDOM(IS_PLAYER(it) && !IS_DEAD(it),
        {
                if(total_traitors >= traitor_count)
@@ -210,36 +256,42 @@ void ttt_RoundStart()
                it.ttt_status = TTT_STATUS_TRAITOR;
        });
 
-       int detective_count = bound(1, ((autocvar_g_ttt_detective_count >= 1) ? autocvar_g_ttt_detective_count : floor(playercount * autocvar_g_ttt_detective_count)), playercount - 1); // 20%, but ensure at least 1 and less than total
-       int total_detectives = 0;
-       FOREACH_CLIENT_RANDOM(IS_PLAYER(it) && !IS_DEAD(it),
+       //detectives TOTAL //Hey, is necessary? I don't think so...
+       /*FOREACH_CLIENT_RANDOM(IS_PLAYER(it) && !IS_DEAD(it),
        {
                if(total_detectives >= detective_count)
                        break;
                total_detectives++;
-               it.ttt_status = TTT_STATUS_DETECTIVE;
-       });
+               //ROUND FIX
+               if (total_detectives <= 1)
+               {
+                       if (total_traitors <= 1)
+                               it.ttt_status = TTT_STATUS_INNOCENT;
+               }
+               else
+                       it.ttt_status = TTT_STATUS_DETECTIVE;
+       });*/
 
        FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it),
        {
-               PrintToChatAll(sprintf("it.karmapoints ^5begin: ^3%f",it.karmapoints));
+               //PrintToChatAll(sprintf("it.karmapoints ^5begin: ^3%f",it.karmapoints));
                if(it.karmapoints <= 0)
                {
-                       //RESETS KARMAPOINTS WHEN MATCH STARTS
-                       PrintToChatAll("^2ZERO RESET");
+                       //Resets karmapoints when match starts
+                       //PrintToChatAll("^2ZERO RESET");
                        GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
                        it.karmapoints = autocvar_g_ttt_max_karma_points;
                }
                else if(it.karmapoints >= autocvar_g_ttt_max_karma_points)
                {
-                       //RESETS KARMAPOINTS TO MAINTAIN THE MAXIMUM
-                       PrintToChatAll("^1MAXIMUM RESET");
+                       //Resets karmapoints to maintain the maximum
+                       //PrintToChatAll("^1MAXIMUM RESET");
                        GameRules_scoring_add(it, TTT_KARMA, autocvar_g_ttt_max_karma_points - it.karmapoints);
                        it.karmapoints = autocvar_g_ttt_max_karma_points;
                }
                else if(it.karmapoints <= autocvar_g_ttt_min_karma_points)
-                       PrintToChatAll("kick kick kick GET OUT!!");
-               PrintToChatAll(sprintf("it.karmapoints ^6end: ^3%f",it.karmapoints));
+                       dropclient(it); //PrintToChatAll("GET OUT!!");
+               //PrintToChatAll(sprintf("it.karmapoints ^6end: ^3%f",it.karmapoints));
 
                if(it.ttt_status == TTT_STATUS_INNOCENT)
                {
@@ -255,8 +307,6 @@ void ttt_RoundStart()
                {
                        Send_Notification(NOTIF_ONE_ONLY, it, MSG_CENTER, CENTER_TTT_DETECTIVE); //Detective notification should be sent to all players to see who is
                        PrintToChatAll(sprintf("%s is ^4Detective^7!", it.netname));
-                       // LegendGuard asks a POLL: Should notify in the center for everyone about who is Detective?
-                       //Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_TTT_DETECTIVE, 1);
                }
 
                ttt_FakeTimeLimit(it, round_handler_GetEndTime());
@@ -340,31 +390,31 @@ MUTATOR_HOOKFUNCTION(ttt, ClientObituary)
                // unless the player is going to be punished for suicide, in which case just remove one
                if(frag_attacker.ttt_status == frag_target.ttt_status)
                {
-                       PrintToChatAll("^1DEBUG^7: A ^2PLAYER^7 has fragged a ^2PLAYER OF HIS OWN TEAM^7, TOO BAD!");
-                       float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.1 );
+                       //PrintToChatAll("^1DEBUG^7: A ^2PLAYER^7 has fragged a ^2PLAYER OF HIS OWN TEAM^7, TOO BAD!");
+                       float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.25 );
                        //PrintToChatAll(sprintf("decreasekarma: ^1%f", decreasekarma));
                        GameRules_scoring_add(frag_attacker, TTT_KARMA, decreasekarma);
                        frag_attacker.karmapoints = frag_attacker.karmapoints + decreasekarma;
                        //PrintToChatAll(sprintf("frag_attacker.karmapoints: ^1%f", frag_attacker.karmapoints));
                        GiveFrags(frag_attacker, frag_target, ((autocvar_g_ttt_punish_teamkill) ? -1 : -2), frag_deathtype, wep_ent.weaponentity_fld);
                        if(frag_attacker.karmapoints <= autocvar_g_ttt_min_karma_points)
-                               PrintToChatAll("kick kick kick GET OUT!!");
-                       //MATH THEORY: example: 1000 * 0.3 * (0.1 + 0.4) * 0.1 // karma points reduce when player attacked to other player
+                               dropclient(frag_attacker); //PrintToChatAll("GET OUT!!");
+                       //BASIC MATH THEORY: example: 1000 * 0.3 * (0.1 + 0.4) * 0.25 // karma points reduce when player attacked to other player
                }
 
                if(frag_attacker.ttt_status == TTT_STATUS_DETECTIVE)
                {
                        if (frag_target.ttt_status == TTT_STATUS_INNOCENT)
                        {       
-                               PrintToChatAll("^1DEBUG^7: A ^4Detective^7 fragged an ^2Innocent^7, TOO BAD!");
-                               float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.1 );
+                               //PrintToChatAll("^1DEBUG^7: A ^4Detective^7 fragged an ^2Innocent^7, TOO BAD!");
+                               float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.25 );
                                //PrintToChatAll(sprintf("decreasekarma: ^1%f", decreasekarma));
                                GameRules_scoring_add(frag_attacker, TTT_KARMA, decreasekarma);
                                frag_attacker.karmapoints = frag_attacker.karmapoints + decreasekarma;
                                //PrintToChatAll(sprintf("frag_attacker.karmapoints: ^1%f", frag_attacker.karmapoints));
                                GiveFrags(frag_attacker, frag_target, ((autocvar_g_ttt_punish_teamkill) ? -1 : -2), frag_deathtype, wep_ent.weaponentity_fld);
                                if(frag_attacker.karmapoints <= autocvar_g_ttt_min_karma_points)
-                                       PrintToChatAll("kick kick kick GET OUT!!");
+                                       dropclient(frag_attacker); //PrintToChatAll("GET OUT!!");
                        }
                }
 
@@ -372,14 +422,14 @@ MUTATOR_HOOKFUNCTION(ttt, ClientObituary)
                {
                        if (frag_target.ttt_status == TTT_STATUS_DETECTIVE)
                        {
-                               PrintToChatAll("^1DEBUG^7: An ^2Innocent^7 fragged a ^4Detective^7, TOO BAD!");
-                               float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.1 );
+                               //PrintToChatAll("^1DEBUG^7: An ^2Innocent^7 fragged a ^4Detective^7, TOO BAD!");
+                               float decreasekarma = -( autocvar_g_ttt_max_karma_points * random() * ( 0.1 + random() ) * 0.25 );
                                //PrintToChatAll(sprintf("decreasekarma: ^1%f", decreasekarma));
                                GameRules_scoring_add(frag_attacker, TTT_KARMA, decreasekarma);
                                frag_attacker.karmapoints = frag_attacker.karmapoints + decreasekarma;
                                GiveFrags(frag_attacker, frag_target, ((autocvar_g_ttt_punish_teamkill) ? -1 : -2), frag_deathtype, wep_ent.weaponentity_fld);
                                if(frag_attacker.karmapoints <= autocvar_g_ttt_min_karma_points)
-                                       PrintToChatAll("kick kick kick GET OUT!!");
+                                       dropclient(frag_attacker); //PrintToChatAll(" GET OUT!!");
                        }
                }
                //if ttt_status is 1, means innocent, 2 means traitor, 3 means detective, TODO: the bots: frag_attacker(1) shouldn't attack to frag_target(3)
@@ -393,16 +443,18 @@ MUTATOR_HOOKFUNCTION(ttt, ClientObituary)
 MUTATOR_HOOKFUNCTION(ttt, PlayerPreThink)
 {
        entity player = M_ARGV(0, entity);
-
+       
        if(IS_PLAYER(player) || player.caplayer)
        {
                // update the scoreboard colour display to out the real killer at the end of the round
                // running this every frame to avoid cheats
                int plcolor = TTT_COLOR_INNOCENT;
+               if(player.ttt_status == TTT_STATUS_INNOCENT && game_stopped) //Innocent status by default
+                       plcolor = TTT_COLOR_INNOCENT;
                if(player.ttt_status == TTT_STATUS_TRAITOR && game_stopped)
                        plcolor = TTT_COLOR_TRAITOR;
                //LegendGuard adds for Detective 21-02-2021
-               if(player.ttt_status == TTT_STATUS_DETECTIVE && game_stopped)
+               if(player.ttt_status == TTT_STATUS_DETECTIVE)// && game_stopped)
                        plcolor = TTT_COLOR_DETECTIVE;
                setcolor(player, plcolor);
        }
@@ -458,6 +510,8 @@ MUTATOR_HOOKFUNCTION(ttt, reset_map_players)
                {
                        TRANSMUTE(Player, it);
                        it.caplayer = 1;
+                       it.respawn_flags = RESPAWN_SILENT; //CSQC print output respawn lib.qh error fix
+                       it.damagedbycontents = true;
                        PutClientInServer(it);
                }
        });
@@ -478,7 +532,9 @@ entity ttt_LastPlayerForTeam(entity this)
                if (!IS_DEAD(it) && this.ttt_status == it.ttt_status)
                {
                        if (!last_pl)
+                       {
                                last_pl = it;
+                       }
                        else
                                return NULL;
                }
@@ -501,15 +557,29 @@ MUTATOR_HOOKFUNCTION(ttt, PlayerDies)
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
        float frag_deathtype = M_ARGV(3, float);
+       //float is_player = (IS_PLAYER(frag_target) || frag_target.classname == "body" || IS_MONSTER(frag_target));
 
+       // Corpse should stay in the round 23-02-2021
+       // issues: when use DAMAGE_NO, makes unmovable and if shotgun shots, corpse crushes and disappears
+       // try to do something for corpse, outside this mutator, try in the event where updates
        ttt_LastPlayerForTeam_Notify(frag_target);
        if (!allowed_to_spawn)
        {
-               frag_target.respawn_flags = RESPAWN_SILENT;
+               frag_target.respawn_flags = RESPAWN_DENY;
                // prevent unwanted sudden rejoin as spectator and movement of spectator camera
                frag_target.respawn_time = time + 2;
        }
-       frag_target.respawn_flags |= RESPAWN_FORCE;
+       frag_target.respawn_flags |= RESPAWN_SILENT;
+       //CORPSE TEST 24-02-2021
+       //frag_target.respawn_flags |= RESPAWN_DENY;
+       //frag_target.deadflag = DEAD_NO;
+       //frag_target.solid = SOLID_SLIDEBOX;
+       //frag_target.solid = SOLID_CORPSE;
+       //set_movetype(frag_target, MOVETYPE_NONE);
+       //frag_target.takedamage = DAMAGE_NO; //it works but it doesn't move... and can be crushed to disappear
+       frag_target.damagedbycontents = false;
+       //LOG_DEBUG("CORPSE CLASSNAME: %s", frag_target.classname);
+       //PrintToChatAll(sprintf("^1fragtarget_classname: ^3%s",frag_target.classname));
        if (!warmup_stage)
        {
                eliminatedPlayers.SendFlags |= 1;
@@ -517,8 +587,6 @@ MUTATOR_HOOKFUNCTION(ttt, PlayerDies)
                        bot_clear(frag_target);
        }
        
-       //TODO: LegendGuard, here is where maybe karma points should be outputted 21-02-2021
-       //TODO: a if for if innocent attacks detective, then reduce points, death_punishment should be disabled for TTT 21-02-2021
        //if(frag_attacker.ttt_status == frag_target.ttt_status)
        // killed an ally! punishment is death
        if(autocvar_g_ttt_punish_teamkill && frag_attacker != frag_target && IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target) && frag_attacker.ttt_status == frag_target.ttt_status && !ITEM_DAMAGE_NEEDKILL(frag_deathtype))
@@ -529,8 +597,8 @@ MUTATOR_HOOKFUNCTION(ttt, PlayerDies)
                if (frag_target.ttt_status == TTT_STATUS_INNOCENT)
                {
                        //PrintToChatAll("^1DEBUG^7: ^4DETECTIVE ^1DAMAGE/DEAD^7 HAS TAKEN!");
-                       //50 damage points deal
-                       Damage(frag_attacker, frag_attacker, frag_attacker, 50, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
+                       //30 damage points deal
+                       Damage(frag_attacker, frag_attacker, frag_attacker, 30, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
                }
        }
        if (frag_attacker.ttt_status == TTT_STATUS_INNOCENT)
@@ -538,8 +606,8 @@ MUTATOR_HOOKFUNCTION(ttt, PlayerDies)
                if (frag_target.ttt_status == TTT_STATUS_DETECTIVE)
                {
                        //PrintToChatAll("^1DEBUG^7: ^2INNOCENT ^1DAMAGE/DEAD^7 HAS TAKEN!");
-                       //50 damage points deal
-                       Damage(frag_attacker, frag_attacker, frag_attacker, 50, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
+                       //30 damage points deal
+                       Damage(frag_attacker, frag_attacker, frag_attacker, 30, DEATH_MIRRORDAMAGE.m_id, DMG_NOWEP, frag_attacker.origin, '0 0 0');
                }
        }
        return true;
index c1e5219fb1cc003c8a48e9dcd4995fcbb0ede097..a9207b35adc9b364f22a0b38c00dc48a4249e253 100644 (file)
@@ -15,4 +15,4 @@ REGISTER_MUTATOR(ttt, false)
 }
 
 .int ttt_validkills; // store the player's valid kills to be given at the end of the match (avoid exposing their score until then)
-.float karmapoints; //LegendGuard adds karma points to store player status
\ No newline at end of file
+.float karmapoints; //LegendGuard adds karma points to store player status 22-02-2021
\ No newline at end of file