Merge branch 'Dev' into Stable

This commit is contained in:
ChocoTaco1 2026-06-14 16:25:14 -04:00
commit bb3c8d6ca1
5 changed files with 138 additions and 30 deletions

View file

@ -12,7 +12,7 @@ function serverCmdClientMakeObserver(%client)
//10 second cooldown on becoming an observer
%timeDif = getSimTime() - %client.observerTimeout;
%timeDif1 = getSimTime() - %client.observerMsg;
if(%timeDif > 10000 || !%client.observerTimeout || %client.isAdmin)
if(%timeDif > 10000 || !%client.observerTimeout || %client.isSuperAdmin)
{
%client.observerProtectStart = getSimTime();
%client.observerTimeout = getSimTime();

View file

@ -42,7 +42,7 @@ function GetTeamCounts(%game)
if($countdownStarted && $MatchStarted)
{
//Variables
$TotalTeamPlayerCount = (Game.class $= "LakRabbitGame") ? $TeamRank[0, count] : ($TeamRank[1, count] + $TeamRank[2, count]);
$TotalTeamPlayerCount = (Game.class $= "LakRabbitGame" || Game.class $= "DMGame") ? $TeamRank[0, count] : ($TeamRank[1, count] + $TeamRank[2, count]);
$AllPlayerCount = $HostGamePlayerCount;
//Observers

View file

@ -23,7 +23,7 @@ $flagOffset = 1;// how far to offset the flag 1m seems like it works 90% of the
//expermental flag static fix
//memPatch("60456c","11000018");//transform
memPatch("6040ff","01"); //setVelocity
//memPatch("6040ff","01"); //setVelocity
$flagResetTime = 0;// 1000-5000 if you want this feature enabled, resets flag to stand in case of desync should not be needed
//best to leave these values alone unless you understand what the code is doing

View file

@ -16,7 +16,7 @@
// Note See bottom of file for full log
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------Settings-----------
$dtStats::version = 10.60;
$dtStats::version = 10.62;
//disable stats system
$dtStats::Enable = $Host::dtStatsEnable $= "" ? ($Host::dtStatsEnable = 1) : $Host::dtStatsEnable;
if(!$dtStats::Enable){ return;}// so it disables with a restart
@ -94,8 +94,8 @@ $dtStats::year = 0;//not
$dtStats::custom = 12;//not used
// you gain extra days based on time played extra days = gameCount * expireFactor;
// example being 100 games * factor of 0.596 = will gain you 60 extra days but if its over the 90 day max it will be deleted
$dtStats::expireMax = 90;
$dtStats::expireMin = 15;
$dtStats::expireMax = 21;
$dtStats::expireMin = 7;
$dtStats::expireFactor["CTFGame"] = 0.596;
$dtStats::expireFactor["LakRabbitGame"] = 2;
$dtStats::expireFactor["DMGame"] = 6;
@ -2271,7 +2271,6 @@ if(!isObject(statsGroup)){
RootGroup.add(statsGroup);
statsGroup.resetCount = -1;
statsGroup.serverStart = 0;
$dtStats::leftID++;
}
function dtAICON(%client){
@ -2783,11 +2782,11 @@ package dtStats{
}
function DefaultGame::playerSpawned(%game, %player){
parent::playerSpawned(%game, %player);
armorTimer(%player.client.dtStats, %player.getArmorSize(), 0);
armorTimer(%player.client.dtStats, %player.getArmorSize());
}
function Player::setArmor(%this,%size){//for game types that use spawn favs
parent::setArmor(%this,%size);
armorTimer(%this.client.dtStats, %size, 0);
armorTimer(%this.client.dtStats, %size);
}
function Weapon::onPickup(%this, %obj, %shape, %amount){
parent::onPickup(%this, %obj, %shape, %amount);
@ -5064,18 +5063,15 @@ function dtStatsMissionDropReady(%game, %client){ // called when client has fini
%dtStats.clientLeft = 0;
%dtStats.stat["clientQuit"] = 0;
%dtStats.markForDelete = 0;
if(%dtStats.leftID == $dtStats::leftID){
$dtServer::mapReconnects[cleanMapName($CurrentMission),%game.class]++;
}
if(isGameRun() && %dtStats.leftID == $dtStats::leftID && %dtStats.stat["score"] != 0){// make sure game is running and we are on the same map
if(isGameRun() && %dtStats.misSeq == $missionSequence){
resGameStats(%client,%game.class); // restore stats;
if(%dtStats.stat["score"] != 0){
messageClient(%client, 'MsgClient', '\crWelcome back %1. Your score has been restored.~wfx/misc/rolechange.wav', %client.name);
}
}
else{
resetDtStats(%dtStats,%game.class,1);
}
if(%client.stat["score"] != 0){
messageClient(%client, 'MsgClient', '\crWelcome back %1. Your score has been restored.~wfx/misc/rolechange.wav', %client.name);
}
break;
}
}
@ -5090,21 +5086,21 @@ function dtStatsMissionDropReady(%game, %client){ // called when client has fini
%dtStats.markForDelete = 0;
%dtStats.name = %name;
$dtStats::tbLookUP[%client.guid] = %dtStats;
resetDtStats(%dtStats,%game.class,1);
}
}
else{
%dtStats = %client.dtStats;
}
%dtStats.misSeq = $missionSequence;
%dtStats.joinPCT = (isGameRun() == 1) ? %game.getGamePct() : 0;
updateTeamTime(%dtStats, -1);
%dtStats.team = %client.team;// should be 0
if(isObject(%dtStats) && %dtStats.gameData[%game.class] != 1){ // game type change
if(isObject(%dtStats) && %dtStats.gameData[%game.class, $dtStats::tmMode] != 1){ // game type change
%dtStats.gameStats["totalGames","g",%game.class] = 0;
%dtStats.gameStats["statsOverWrite","g",%game.class] = -1;
%dtStats.gameStats["fullSet","g",%game.class] = 0;
resetDtStats(%dtStats,%game.class,1);
%dtStats.gameData[%game.class] = 0;
%dtStats.gameData[%game.class, $dtStats::tmMode] = 0;
}
%dtStats.mapTime = getSimTime();
}
@ -5123,12 +5119,11 @@ function dtStatsClientLeaveGame(%client){
%client.dtStats.isBot = (%client.isWatchOnly == 1);
%dtStats.stat["clientQuit"] = isGameRun();
%client.dtStats.leftTime = getSimTime();
%client.dtStats.leftID = $dtStats::leftID;
if(isObject(Game)){
%client.dtStats.leftPCT = Game.getGamePct();
if(isGameRun() && %client.score != 0){
updateTeamTime(%client.dtStats, %client.dtStats.team);
armorTimer(%client.dtStats, 0, 1);
armorTimer(%client.dtStats, -1);
}
}
else{
@ -5738,7 +5733,6 @@ function loadTBMap(%game){
function dtSaveDone(){
$dtStats::statsSave = 0;
$dtStats::leftID++;
$dtStats::teamOneCapTimes = 0;
$dtStats::teamTwoCapTimes = 0;
$dtStats::teamOneCapCount = 0;
@ -5752,6 +5746,9 @@ function DefaultGame::postGameStats(%game,%dtStats){ //stats to add up at the en
if($dtStats::debugEchos){error("postGameStats GUID = " SPC %dtStats.guid);}
if(!isObject(%dtStats))
return;
armorTimer(%dtStats, -1);
%dtStats.stat["tournamentMode"] = $Host::TournamentMode;
%dtStats.stat["null"] = getRandom(1,100);
@ -6264,7 +6261,7 @@ function loadGameStats(%dtStats,%game){// called when client joins server.cs onC
%var = getField(%line,0);
%dtStats.gameStats[%var,"g",%game,$dtStats::tmMode] = getFields(%line,1,getFieldCount(%line)-1);
}
%dtStats.gameData[%game,$dtStats::tmMode]= 1;
%dtStats.gameData[%game, $dtStats::tmMode]= 1;
%file.close();
%file.delete();
}
@ -6975,7 +6972,7 @@ function buildVarList(){
////////////////////////////////////////////////////////////////////////////////
//Stats Collecting
////////////////////////////////////////////////////////////////////////////////
function armorTimer(%dtStats, %size, %death){
function armorTimer(%dtStats, %size){
if(%dtStats.lastArmor $= "Light" && %dtStats.ArmorTime[%dtStats.lastArmor] > 0){
%dtStats.stat["lArmorTime"] += ((getSimTime() - %dtStats.ArmorTime[%dtStats.lastArmor])/1000)/60;
%dtStats.ArmorTime[%dtStats.lastArmor] = 0;
@ -6991,7 +6988,7 @@ function armorTimer(%dtStats, %size, %death){
%dtStats.ArmorTime[%dtStats.lastArmor] = 0;
%dtStats.lastArmor = 0;
}
if(!%death){
if(%size == -1){
%dtStats.ArmorTime[%size] = getSimTime();
%dtStats.lastArmor = %size;
}
@ -7090,7 +7087,7 @@ function clientKillStats(%game,%clVictim, %clKiller, %damageType, %implement, %d
%victimPlayer = isObject(%clVictim.player) ? %clVictim.player : %clVictim.lastPlayer;
%killerPlayer = isObject(%clKiller.player) ? %clKiller.player : %clKiller.lastPlayer;
%clVictim.lp = "";//last position for distMove
armorTimer(%victimDT, 0, 1);
armorTimer(%victimDT, -1);
//------------------------------------------------------------------------------
%victimDT.timeToLive += getSimTime() - %clVictim.spawnTime;
%victimDT.stat["timeTL"] = mFloor(((%victimDT.timeToLive/(%clVictim.stat["deaths"]+%clVictim.stat["suicides"] ? %clVictim.stat["deaths"]+%clVictim.stat["suicides"] : 1))/1000)/60);
@ -14004,7 +14001,7 @@ package dtBanSys{
name = %name;
guid = %guid;
ip = %bareip;
banDateTime = dtMarkDate();
banDateTime = dtMarkDate();
banLengthMin = %time;
};
dtBanList.add(%banObj);
@ -20539,7 +20536,7 @@ function mapCyleTest(){
// Misc arena things
// Added LCTF Naming
// serverPrefs Support
// bansystem rework doto new tribes next changes
// bansystem rework doto new tribes next changes
////////////////////////////////////////////////////////////////////////////////
@ -20558,4 +20555,4 @@ function testVarsRandomAll(%max){
dtMinMax(%varName, "misc", 1, %val, %client);
}
}
}
}

View file

@ -0,0 +1,111 @@
// auto reteam clients that have drop
//script by: DarkTiger
//version 1.1
function tmMirrorTeam(%client){
if (!$Host::TournamentMode){
return;
}
if (%client.team <= 0){
return;
}
%guid = %client.guid;
if (%guid $= "" || %guid == 0){
return;
}
$TourneyRejoinTeam[%guid] = %client.team;
$TourneyRejoinSeq[%guid] = $missionSequence;
%client.recDrop = 1;
echo("TourneyRejoin: saved team info for " @ %client.nameBase
@ " (GUID:" @ %guid @ ") team=" @ %client.team
@ " seq=" @ $missionSequence);
}
function tmRejoin(%game, %client){
if (!$Host::TournamentMode || !$missionRunning){
return;
}
%guid = %client.guid;
if (%guid $= "" || %guid == 0){
return;
}
if ($TourneyRejoinSeq[%guid] $= ""){
return;
}
if ($TourneyRejoinSeq[%guid] != $missionSequence){
$TourneyRejoinTeam[%guid] = "";
$TourneyRejoinSeq[%guid] = "";
return;
}
%savedTeam = $TourneyRejoinTeam[%guid];
// Consume the record so a second reconnect goes through normal pick-team flow
$TourneyRejoinTeam[%guid] = "";
$TourneyRejoinSeq[%guid] = "";
echo("TourneyRejoin: restoring" SPC %client.nameBase SPC "(GUID:" @ %guid @ ") to team " @ %savedTeam);
%game.clientChangeTeam(%client, %savedTeam, 1, true);
//%game.clientJoinTeam( %client, %savedTeam, false );
if (!$MatchStarted && !$countdownStarted){
clearBottomPrint(%client);
%client.observerMode = "pregame";
%client.notReady = true;
centerprint(%client, "\nPress FIRE when ready.", 0, 3);
messageClient(%client, 'MsgClient',
'\c2You have been re-teamed to %1 after reconnecting. Press FIRE when ready.',
%game.getTeamName(%savedTeam));
}
else{
clearBottomPrint(%client);
%client.notReady = false;
commandToClient(%client, 'setHudMode', 'Standard');
messageClient(%client, 'MsgClient',
'\c2You have been re-teamed to %1 after reconnecting.',
%game.getTeamName(%savedTeam));
}
%client.isRejoin = 1;
messageAllExcept(%client, -1, 'MsgClient',
'\c2%1 reconnected and has been restored to %2.',
%client.name, %game.getTeamName(%savedTeam));
}
package TourneyRejoinPackage{
// Mirror team to global whenever a client joins a team
function DefaultGame::clientJoinTeam(%game, %client, %team, %respawn){
Parent::clientJoinTeam(%game, %client, %team, %respawn);
tmMirrorTeam(%client);
}
// Mirror team to global whenever a client changes team
function DefaultGame::clientChangeTeam(%game, %client, %team, %fromObs, %respawned){
Parent::clientChangeTeam(%game, %client, %team, %fromObs, %respawned);
tmMirrorTeam(%client);
}
function DefaultGame::clientMissionDropReady(%game, %client){
parent::clientMissionDropReady(%game, %client);
schedule(32, 0, "tmRejoin", %game, %client);
%client.isRejoin = 0;
}
function serverCmdPlayContentSet( %client ){
if(!%client.isRejoin){// block the join team ui if they are already ready on a team
parent::serverCmdPlayContentSet(%client);
}
else{
%client.isRejoin = 0;
}
}
};
if (!isActivePackage(TourneyRejoinPackage)){
activatePackage(TourneyRejoinPackage);
}