From c5080559e68b0e902b7001e57ccf7703694c0612 Mon Sep 17 00:00:00 2001 From: puzl Date: Sat, 14 May 2005 16:11:00 +0000 Subject: [PATCH] Mantis: 984 o Added ReadyRoomThrottleMessage to titles.txt o Player has to press f4 twice within two seconds to go to the readyroom git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@113 67975925-1194-0748-b3d5-c16f83f1a3a1 --- main/source/mod/AvHConsoleCommands.cpp | 15 +++++++++++++-- main/source/mod/AvHPlayer.cpp | 17 +++++++++++++++-- main/source/mod/AvHPlayer.h | 8 ++++++-- main/source/mod/AvHTitles.h | 1 + main/titles.txt | 5 +++++ 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/main/source/mod/AvHConsoleCommands.cpp b/main/source/mod/AvHConsoleCommands.cpp index 72fb09da..0b911ee5 100644 --- a/main/source/mod/AvHConsoleCommands.cpp +++ b/main/source/mod/AvHConsoleCommands.cpp @@ -337,9 +337,20 @@ BOOL AvHGamerules::ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) { if(!theAvHPlayer->GetIsBeingDigested()) { - theAvHPlayer->SetPlayMode(PLAYMODE_READYROOM, true); + // puzl: 984 + // Add a throttle on the readyroom key + const static int kReadyRoomThrottleTimeout=2.0f; + if ( (theAvHPlayer->GetTimeLastF4() == -1.0f) || + (gpGlobals->time > theAvHPlayer->GetTimeLastF4() + kReadyRoomThrottleTimeout) ) + { + theAvHPlayer->SendMessage(kReadyRoomThrottleMessage); + theAvHPlayer->SetTimeLastF4(gpGlobals->time); + } + else if ( gpGlobals->time < theAvHPlayer->GetTimeLastF4() + kReadyRoomThrottleTimeout ) + { + theAvHPlayer->SetPlayMode(PLAYMODE_READYROOM, true); + } } - theSuccess = true; } } diff --git a/main/source/mod/AvHPlayer.cpp b/main/source/mod/AvHPlayer.cpp index 66b82624..ef1764e1 100644 --- a/main/source/mod/AvHPlayer.cpp +++ b/main/source/mod/AvHPlayer.cpp @@ -3375,6 +3375,10 @@ void AvHPlayer::Init() this->mClientSpecialPASOrigin.x = this->mClientSpecialPASOrigin.y = this->mClientSpecialPASOrigin.z = 0.0f; this->mTimeOfLastPASUpdate = -1; + // puzl: 984 + // record the last time the player attempted to go to the readyroom + this->mTimeOfLastF4 = -1.0f; + this->mTimeOfLastTeleport = -1; this->mTimeOfLastHelpText = -1; this->mTimeOfLastUse = -1; @@ -6003,8 +6007,7 @@ void AvHPlayer::InternalAlienUpgradesRegenerationThink() void AvHPlayer::ProcessEntityBlip(CBaseEntity* inEntity) { - const float kAlienFriendlyBlipRange = 1500; - //const float kAlienEnemyBlipRange = 1500; + const float kAlienEnemyBlipRange = 1500; // Is player alien? bool theIsAlien = this->GetIsAlien(true); @@ -8088,6 +8091,16 @@ void AvHPlayer::SetHasGivenOrder(bool inState) this->mHasGivenOrder = inState; } +float AvHPlayer::GetTimeLastF4() const +{ + return this->mTimeOfLastF4; +} + +void AvHPlayer::SetTimeLastF4(float inTime) +{ + this->mTimeOfLastF4=inTime; +} + float AvHPlayer::GetTimeStartedTopDown() const { return this->mTimeStartedTopDown; diff --git a/main/source/mod/AvHPlayer.h b/main/source/mod/AvHPlayer.h index 8b9d9034..86a1d06a 100644 --- a/main/source/mod/AvHPlayer.h +++ b/main/source/mod/AvHPlayer.h @@ -298,6 +298,8 @@ public: virtual void GiveNamedItem(const char *szName, bool inSendMessage = false); int GetNumberOfItems(); void GiveResources(float inResources); + float GetTimeLastF4() const; + void SetTimeLastF4(float inTime); float GetTimeStartedTopDown() const; float GetTimeOfLastConstructUse() const; void SetTimeOfLastConstructUse(float inTime); @@ -626,7 +628,8 @@ private: bool mClientInTopDownMode; bool mInTopDownMode; int mTimeStartedTopDown; - + + float mTimeOfLastF4; float mTimeOfLastSaying; AvHMessageID mLastSaying; bool mIsSpeaking; @@ -687,6 +690,7 @@ private: Vector mClientSpecialPASOrigin; float mTimeOfLastPASUpdate; + bool mClientIsAlien; bool mAlienSightActive; @@ -778,7 +782,7 @@ private: bool mNeedsTeamUpdate; bool mSendTeamUpdate; bool mSendSpawnScreenFade; - + int mDigestee; float mTimeOfLastDigestDamage; float mTimeOfLastCombatThink; diff --git a/main/source/mod/AvHTitles.h b/main/source/mod/AvHTitles.h index 3448b169..df162663 100644 --- a/main/source/mod/AvHTitles.h +++ b/main/source/mod/AvHTitles.h @@ -63,6 +63,7 @@ // Messages #define kReadyRoomMessage "ReadyRoomMessage" +#define kReadyRoomThrottleMessage "ReadyRoomThrottleMessage" #define kReinforcementMessage "ReinforcementMessage" #define kReinforcingMessage "ReinforcingMessage" #define kObserverMessage "ObserverMessage" diff --git a/main/titles.txt b/main/titles.txt index d617756f..9817e118 100644 --- a/main/titles.txt +++ b/main/titles.txt @@ -409,6 +409,11 @@ ReadyRoomMessage You are in the Ready Room. Walk through an entrance to join a team or observe the game. } +ReadyRoomThrottleMessage +{ +You must press the key twice to return to the Ready Room +} + ReinforcementMessage { You are waiting in line to spawn back in.