mirror of
https://github.com/unknownworlds/NS.git
synced 2025-02-21 19:21:19 +00:00
o Lowered the rate of players being forced to the RR from 8/sec to 5/sec.
o Added throttling to the resetting of players. It resets players at a rate of 6 players per 0.3s. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@441 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
3662dedb2e
commit
d05ab49a2b
5 changed files with 72 additions and 22 deletions
|
@ -136,7 +136,7 @@ const int kMaxUpgradeLevel = 3;
|
||||||
const int kFuncResourceMaxResources = 300;
|
const int kFuncResourceMaxResources = 300;
|
||||||
//const float kPlayerResourceScalar = 2.0f; // 1.5 might be better
|
//const float kPlayerResourceScalar = 2.0f; // 1.5 might be better
|
||||||
const int kVictoryIntermission = 12;
|
const int kVictoryIntermission = 12;
|
||||||
const int kResetPlayersPerSecond = 8;
|
const int kResetPlayersPerSecond = 5;
|
||||||
const float kBuildingUseWarmupTime = 2.0f;
|
const float kBuildingUseWarmupTime = 2.0f;
|
||||||
const float kRedeemInvulnerableTime = 1.0f;
|
const float kRedeemInvulnerableTime = 1.0f;
|
||||||
|
|
||||||
|
|
|
@ -2511,6 +2511,8 @@ void AvHGamerules::ResetGame(bool inPreserveTeams)
|
||||||
this->mFirstUpdate = true;
|
this->mFirstUpdate = true;
|
||||||
this->mPreserveTeams = inPreserveTeams;
|
this->mPreserveTeams = inPreserveTeams;
|
||||||
gSvCheatsLastUpdateTime = -1.0f;
|
gSvCheatsLastUpdateTime = -1.0f;
|
||||||
|
this->mHasPlayersToReset = false;
|
||||||
|
this->mLastPlayerResetTime = -1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvHGamerules::RecalculateMapMode( void )
|
void AvHGamerules::RecalculateMapMode( void )
|
||||||
|
@ -2648,16 +2650,18 @@ void AvHGamerules::MarkDramaticEvent(int inPriority, short inPrimaryEntityIndex,
|
||||||
this->MarkDramaticEvent(inPriority, inPrimaryEntityIndex, secondaryEntityIndex);
|
this->MarkDramaticEvent(inPriority, inPrimaryEntityIndex, secondaryEntityIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvHGamerules::ResetEntities()
|
// Resets players in chunks of 6 and 6
|
||||||
|
void AvHGamerules::ResetPlayers()
|
||||||
{
|
{
|
||||||
// Now reset all the world entities and mark useable ones with AVH_USER3_USEABLE
|
const int maxReset = 6;
|
||||||
//AvHSUPrintDevMessage("FOR_ALL_BASEENTITIES: AvHGamerules::ResetEntities\n");
|
int numReset = 0;
|
||||||
|
|
||||||
FOR_ALL_BASEENTITIES();
|
FOR_ALL_BASEENTITIES();
|
||||||
|
|
||||||
// Reset the entity. Assumes that players in the ready room have already been reset recently.
|
// Reset the players
|
||||||
|
// Reset only players that have made it to the readyroom and have been on either team
|
||||||
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
|
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
|
||||||
if(thePlayer && (thePlayer->GetPlayMode() == PLAYMODE_READYROOM))
|
if(thePlayer && (thePlayer->GetPlayMode() == PLAYMODE_READYROOM) && (thePlayer->GetHasSeenATeam()))
|
||||||
{
|
{
|
||||||
int theUser3 = thePlayer->pev->iuser3;
|
int theUser3 = thePlayer->pev->iuser3;
|
||||||
int theUser4 = thePlayer->pev->iuser4;
|
int theUser4 = thePlayer->pev->iuser4;
|
||||||
|
@ -2672,38 +2676,65 @@ void AvHGamerules::ResetEntities()
|
||||||
thePlayer->pev->playerclass = thePlayMode;
|
thePlayer->pev->playerclass = thePlayMode;
|
||||||
thePlayer->pev->team = thePlayerTeam;
|
thePlayer->pev->team = thePlayerTeam;
|
||||||
thePlayer->pev->solid = theSolidType;
|
thePlayer->pev->solid = theSolidType;
|
||||||
|
|
||||||
|
if (numReset++ >= maxReset)
|
||||||
|
{
|
||||||
|
this->mHasPlayersToReset = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
END_FOR_ALL_BASEENTITIES();
|
||||||
|
|
||||||
|
this->mHasPlayersToReset = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvHGamerules::ResetEntities()
|
||||||
|
{
|
||||||
|
// Now reset all the world entities and mark useable ones with AVH_USER3_USEABLE
|
||||||
|
//AvHSUPrintDevMessage("FOR_ALL_BASEENTITIES: AvHGamerules::ResetEntities\n");
|
||||||
|
|
||||||
|
FOR_ALL_BASEENTITIES();
|
||||||
|
|
||||||
|
// Reset non-player entities
|
||||||
|
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
|
||||||
|
if(thePlayer && (thePlayer->GetPlayMode() == PLAYMODE_READYROOM)) // && (thePlayer->GetHasSeenATeam()))
|
||||||
|
{
|
||||||
|
// SNIP
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theBaseEntity->ResetEntity();
|
theBaseEntity->ResetEntity();
|
||||||
}
|
|
||||||
|
|
||||||
// Don't mark commander stations as useable in this case
|
// Don't mark commander stations as useable in this case
|
||||||
AvHCommandStation* theCommandStation = dynamic_cast<AvHCommandStation*>(theBaseEntity);
|
AvHCommandStation* theCommandStation = dynamic_cast<AvHCommandStation*>(theBaseEntity);
|
||||||
if(!theCommandStation)
|
if(!theCommandStation)
|
||||||
{
|
|
||||||
int theObjectCaps = theBaseEntity->ObjectCaps();
|
|
||||||
if(theObjectCaps & (FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE))
|
|
||||||
{
|
{
|
||||||
// After playing once, this is no longer zero
|
int theObjectCaps = theBaseEntity->ObjectCaps();
|
||||||
if(theBaseEntity->pev->iuser3 == 0)
|
if(theObjectCaps & (FCAP_IMPULSE_USE | FCAP_CONTINUOUS_USE | FCAP_ONOFF_USE))
|
||||||
{
|
{
|
||||||
theBaseEntity->pev->iuser3 = AVH_USER3_USEABLE;
|
// After playing once, this is no longer zero
|
||||||
|
if(theBaseEntity->pev->iuser3 == 0)
|
||||||
// Now also mark the target entity as useable!
|
|
||||||
if (!FStringNull(theBaseEntity->pev->target))
|
|
||||||
{
|
{
|
||||||
CBaseEntity* theTarget = NULL;
|
theBaseEntity->pev->iuser3 = AVH_USER3_USEABLE;
|
||||||
|
|
||||||
while(theTarget = UTIL_FindEntityByTargetname(theTarget, STRING(theBaseEntity->pev->target)))
|
// Now also mark the target entity as useable!
|
||||||
|
if (!FStringNull(theBaseEntity->pev->target))
|
||||||
{
|
{
|
||||||
theTarget->pev->iuser3 = AVH_USER3_USEABLE;
|
CBaseEntity* theTarget = NULL;
|
||||||
|
|
||||||
|
while(theTarget = UTIL_FindEntityByTargetname(theTarget, STRING(theBaseEntity->pev->target)))
|
||||||
|
{
|
||||||
|
theTarget->pev->iuser3 = AVH_USER3_USEABLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
END_FOR_ALL_BASEENTITIES();
|
END_FOR_ALL_BASEENTITIES();
|
||||||
|
|
||||||
|
this->mHasPlayersToReset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvHGamerules::InternalResetGameRules()
|
void AvHGamerules::InternalResetGameRules()
|
||||||
|
@ -3196,6 +3227,13 @@ void AvHGamerules::Think(void)
|
||||||
this->mFirstUpdate = false;
|
this->mFirstUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float playerResetDelay = 0.3f;
|
||||||
|
if(this->mHasPlayersToReset && (this->mLastPlayerResetTime + playerResetDelay < theTime) )
|
||||||
|
{
|
||||||
|
this->ResetPlayers();
|
||||||
|
this->mLastPlayerResetTime = theTime;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle queued network messages
|
// Handle queued network messages
|
||||||
#ifdef USE_NETWORK_METERING
|
#ifdef USE_NETWORK_METERING
|
||||||
const float kNetworkUpdateInterval = .1f;
|
const float kNetworkUpdateInterval = .1f;
|
||||||
|
|
|
@ -324,6 +324,7 @@ private:
|
||||||
void PostVictoryStatsToWeb(const string& inFormParams) const;
|
void PostVictoryStatsToWeb(const string& inFormParams) const;
|
||||||
bool ReadyToStartCountdown();
|
bool ReadyToStartCountdown();
|
||||||
void ResetGame(bool inPreserveTeams = false);
|
void ResetGame(bool inPreserveTeams = false);
|
||||||
|
void ResetPlayers();
|
||||||
void SendGameTimeUpdate(bool inReliable = false);
|
void SendGameTimeUpdate(bool inReliable = false);
|
||||||
void ProcessTeamUpgrades();
|
void ProcessTeamUpgrades();
|
||||||
void ResetEntities();
|
void ResetEntities();
|
||||||
|
@ -417,6 +418,9 @@ private:
|
||||||
std::vector<std::string> mServerVariableList;
|
std::vector<std::string> mServerVariableList;
|
||||||
|
|
||||||
AvHTeamNumber mCombatAttackingTeamNumber;
|
AvHTeamNumber mCombatAttackingTeamNumber;
|
||||||
|
|
||||||
|
bool mHasPlayersToReset;
|
||||||
|
float mLastPlayerResetTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
AvHGamerules* GetGameRules();
|
AvHGamerules* GetGameRules();
|
||||||
|
|
|
@ -4029,6 +4029,11 @@ bool AvHPlayer::GetHasActiveAlienWeaponWithImpulse(AvHMessageID inMessageID) con
|
||||||
return theHasWeapon;
|
return theHasWeapon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AvHPlayer::GetHasSeenATeam()
|
||||||
|
{
|
||||||
|
return (this->mHasSeenTeamA || this->mHasSeenTeamB);
|
||||||
|
}
|
||||||
|
|
||||||
bool AvHPlayer::GetHasSeenTeam(AvHTeamNumber inNumber) const
|
bool AvHPlayer::GetHasSeenTeam(AvHTeamNumber inNumber) const
|
||||||
{
|
{
|
||||||
bool theHasBeenOnTeam = false;
|
bool theHasBeenOnTeam = false;
|
||||||
|
@ -7095,6 +7100,7 @@ void AvHPlayer::ResetEntity(void)
|
||||||
this->mNewMap = theSavedNewMap;
|
this->mNewMap = theSavedNewMap;
|
||||||
this->mDesiredNetName = theSavedDesiredNetName;
|
this->mDesiredNetName = theSavedDesiredNetName;
|
||||||
this->mClientInfoLocations = theSavedClientInfoLocations;
|
this->mClientInfoLocations = theSavedClientInfoLocations;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvHPlayer::ResetOverwatch()
|
void AvHPlayer::ResetOverwatch()
|
||||||
|
|
|
@ -478,6 +478,8 @@ public:
|
||||||
// tankefugl: 0000953
|
// tankefugl: 0000953
|
||||||
bool JoinTeamCooledDown(float inCoolDownTime);
|
bool JoinTeamCooledDown(float inCoolDownTime);
|
||||||
// tankefugl
|
// tankefugl
|
||||||
|
|
||||||
|
bool GetHasSeenATeam();
|
||||||
private:
|
private:
|
||||||
void AcquireOverwatchTarget();
|
void AcquireOverwatchTarget();
|
||||||
bool AttemptToBuildAlienStructure(AvHMessageID inMessageID);
|
bool AttemptToBuildAlienStructure(AvHMessageID inMessageID);
|
||||||
|
|
Loading…
Reference in a new issue