Skip to content

Commit 731236d

Browse files
committed
funny engineer changes for the day
1 parent f98b280 commit 731236d

20 files changed

+178
-49
lines changed

src/game/client/tf/c_baseobject.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ class C_BaseObject : public C_BaseCombatCharacter, public IHasBuildPoints, publi
177177
// Build points
178178
CUtlVector<BuildPoint_t> m_BuildPoints;
179179

180-
bool IsDisabled( void ) { return m_bDisabled || m_bCarried; }
180+
bool ShouldBeActiveWhileCarried() const
181+
{
182+
// Dispenser active while carried
183+
return m_iObjectType == OBJ_DISPENSER;
184+
}
185+
bool IsDisabled( void ) { return m_bDisabled || m_bCarried && !ShouldBeActiveWhileCarried(); }
181186

182187
// Shared placement
183188
bool VerifyCorner( const Vector &vBottomCenter, float xOffset, float yOffset );

src/game/client/tf/c_obj_teleporter.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ using namespace vgui;
2828
IMPLEMENT_CLIENTCLASS_DT(C_ObjectTeleporter, DT_ObjectTeleporter, CObjectTeleporter)
2929
RecvPropInt( RECVINFO(m_iState) ),
3030
RecvPropTime( RECVINFO(m_flRechargeTime) ),
31+
RecvPropInt(RECVINFO(m_iTeleportCooldownUsers)),
32+
RecvPropTime(RECVINFO(m_flTeleportCooldownTime)),
3133
RecvPropTime( RECVINFO(m_flCurrentRechargeDuration) ),
3234
RecvPropInt( RECVINFO(m_iTimesUsed) ),
3335
RecvPropFloat( RECVINFO(m_flYawToExit) ),
@@ -99,7 +101,7 @@ void C_ObjectTeleporter::StartChargedEffects()
99101
char szEffect[128];
100102

101103
Q_snprintf( szEffect, sizeof(szEffect), "teleporter_%s_charged_level%d",
102-
( GetTeamNumber() == TF_TEAM_RED ) ? "red" : "blue", GetUpgradeLevel() );
104+
( GetTeamNumber() == TF_TEAM_RED ) ? "red" : "blue", MIN(GetUpgradeLevel(), 3) );
103105

104106
Assert( m_hChargedEffect.m_pObject == NULL );
105107
m_hChargedEffect = ParticleProp()->Create( szEffect, PATTACH_ABSORIGIN );
@@ -110,10 +112,11 @@ void C_ObjectTeleporter::StartActiveEffects()
110112
StopActiveEffects();
111113
char szEffect[128];
112114

115+
int iBaseUpgradeLevel = MIN(GetUpgradeLevel(), 3);
113116
Q_snprintf( szEffect, sizeof(szEffect), "teleporter_%s_%s_level%d",
114117
( GetTeamNumber() == TF_TEAM_RED ) ? "red" : "blue",
115118
GetObjectMode() == MODE_TELEPORTER_ENTRANCE ? "entrance" : "exit",
116-
GetUpgradeLevel() );
119+
iBaseUpgradeLevel );
117120

118121
Assert( m_hDirectionEffect.m_pObject == NULL );
119122
m_hDirectionEffect = ParticleProp()->Create( szEffect, PATTACH_ABSORIGIN );
@@ -136,7 +139,7 @@ void C_ObjectTeleporter::StartActiveEffects()
136139
m_pSpinSound = NULL;
137140
}
138141
char szSound[128];
139-
Q_snprintf( szSound, sizeof(szSound), "Building_Teleporter.SpinLevel%d", GetUpgradeLevel());
142+
Q_snprintf( szSound, sizeof(szSound), "Building_Teleporter.SpinLevel%d", iBaseUpgradeLevel);
140143

141144
CLocalPlayerFilter filter;
142145
m_pSpinSound = controller.SoundCreate( filter, entindex(), szSound );

src/game/client/tf/c_obj_teleporter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class C_ObjectTeleporter : public C_BaseObject
6868
int m_iState;
6969
int m_iOldState;
7070
float m_flRechargeTime;
71+
int m_iTeleportCooldownUsers;
72+
float m_flTeleportCooldownTime;
7173
float m_flCurrentRechargeDuration;
7274
int m_iTimesUsed;
7375
float m_flYawToExit;

src/game/client/tf/tf_hud_building_status.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void CBuildingStatusItem::PerformLayout( void )
204204
m_pBuildingPanel->SetVisible( false );
205205
m_pRunningPanel->SetVisible( true );
206206

207-
int iUpgradeLevel = pObj->GetUpgradeLevel();
207+
int iUpgradeLevel = MIN(pObj->GetUpgradeLevel(), 3);
208208

209209
Assert( iUpgradeLevel >= 1 && iUpgradeLevel <= 3 );
210210

@@ -1032,7 +1032,7 @@ void CBuildingStatusItem_TeleporterEntrance::PerformLayout( void )
10321032
// How many times has this teleporter been used?
10331033
m_pFullyChargedPanel->SetDialogVariable( "timesused", pTeleporter->GetTimesUsed() );
10341034

1035-
int iUpgradeLevel = pTeleporter->GetUpgradeLevel();
1035+
int iUpgradeLevel = MIN(pTeleporter->GetUpgradeLevel(), 3);
10361036

10371037
Assert( iUpgradeLevel >= 1 && iUpgradeLevel <= 3 );
10381038

@@ -1071,7 +1071,7 @@ void CBuildingStatusItem_TeleporterExit::PerformLayout( void )
10711071
return;
10721072
}
10731073

1074-
int iUpgradeLevel = pTeleporter->GetUpgradeLevel();
1074+
int iUpgradeLevel = MIN(pTeleporter->GetUpgradeLevel(), 3);
10751075

10761076
Assert( iUpgradeLevel >= 1 && iUpgradeLevel <= 3 );
10771077

src/game/client/tf/tf_hud_menu_engy_build.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,17 @@ void CHudMenuEngyBuild::SendBuildMessage( int iSlot )
468468
iBuildDisposableSents = pLocalPlayer->CanBuild( iBuilding, iMode );
469469
}
470470

471+
if (pLocalPlayer->m_Shared.IsCarryingObject())
472+
{
473+
if (pLocalPlayer->m_Shared.GetCarriedObject()->GetType() != iBuilding || pLocalPlayer->m_Shared.GetCarriedObject()->GetObjectMode() != iMode)
474+
{
475+
pLocalPlayer->EmitSound("Player.DenyWeaponSelection");
476+
return;
477+
}
478+
}
479+
471480
// If we don't already have a sentry (NULL), or we're allowed to build multiple, and we can afford it
472-
if ( ( pObj == NULL || iBuildDisposableSents == CB_CAN_BUILD ) && pLocalPlayer->GetAmmoCount( TF_AMMO_METAL ) >= iCost )
481+
if ( ( pObj == NULL || iBuildDisposableSents == CB_CAN_BUILD ) && pLocalPlayer->GetAmmoCount( TF_AMMO_METAL ) >= iCost || pObj != NULL && pObj->IsCarried() )
473482
{
474483
char szCmd[128];
475484
Q_snprintf( szCmd, sizeof(szCmd), "build %d %d", iBuilding, iMode );

src/game/client/tf/tf_hud_menu_eureka_teleport.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ void CHudEurekaEffectTeleportMenu::OnTick( void )
399399
&& !pObj->IsBuilding()
400400
&& !pObj->IsPlacing()
401401
&& !pObj->IsUpgrading()
402-
&& !pObj->IsCarried();
402+
&& (!pObj->IsCarried() || pObj->ShouldBeActiveWhileCarried());
403403

404404
m_pAvilableTargets[ EUREKA_TELEPORT_TELEPORTER_EXIT ]->SetVisible( bTeleAvailable );
405405
m_pUnavailableTargets[ EUREKA_TELEPORT_TELEPORTER_EXIT ]->SetVisible( !bTeleAvailable );

src/game/client/tf/tf_hud_spectator_extras.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ void CTFHudSpectatorExtras::OnTick()
308308
}
309309
else
310310
{
311-
switch ( pObject->GetUpgradeLevel() )
311+
switch ( MIN(pObject->GetUpgradeLevel(), 3) )
312312
{
313313
case 1:
314314
m_vecEntitiesToDraw[nVecIndex].m_nOffset = 50;

src/game/server/tf/bot/behavior/tf_bot_use_teleporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ bool CTFBotUseTeleporter::IsTeleporterAvailable( void ) const
4747
if ( m_teleporter->GetState() == TELEPORTER_STATE_SENDING ||
4848
m_teleporter->GetState() == TELEPORTER_STATE_RECHARGING )
4949
{
50-
if ( m_teleporter->GetUpgradeLevel() == 3 )
50+
if ( m_teleporter->GetUpgradeLevel() >= 3 )
5151
{
5252
// we'll wait for level 3 teleporters - they're really fast
5353
return true;

src/game/server/tf/tf_obj.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ IMPLEMENT_SERVERCLASS_ST(CBaseObject, DT_BaseObject)
174174
SendPropVector( SENDINFO( m_vecBuildMins ), -1, SPROP_COORD ),
175175
SendPropInt( SENDINFO( m_iDesiredBuildRotations ), 2, SPROP_UNSIGNED ),
176176
SendPropBool( SENDINFO( m_bServerOverridePlacement ) ),
177-
SendPropInt( SENDINFO(m_iUpgradeLevel), 3 ),
177+
SendPropInt( SENDINFO(m_iUpgradeLevel), 5 ),
178178
SendPropInt( SENDINFO(m_iUpgradeMetal), 10 ),
179179
SendPropInt( SENDINFO(m_iUpgradeMetalRequired), 10 ),
180180
SendPropInt( SENDINFO(m_iHighestUpgradeLevel), 3 ),
@@ -2859,6 +2859,10 @@ bool CBaseObject::CheckUpgradeOnHit( CTFPlayer *pPlayer )
28592859
{
28602860
int iPlayerMetal = pPlayer->GetAmmoCount( TF_AMMO_METAL );
28612861
int nMaxToAdd = GetUpgradeAmountPerHit();
2862+
if (nMaxToAdd < 1)
2863+
{
2864+
return false;
2865+
}
28622866
CALL_ATTRIB_HOOK_INT_ON_OTHER( pPlayer, nMaxToAdd, upgrade_rate_mod );
28632867
int iAmountToAdd = Min( nMaxToAdd, iPlayerMetal );
28642868

@@ -3031,8 +3035,11 @@ void CBaseObject::StartUpgrading( void )
30313035
if ( !m_bCarryDeploy && !IsUsingReverseBuild() )
30323036
{
30333037
int iMaxHealth = GetMaxHealthForCurrentLevel();
3034-
SetMaxHealth( iMaxHealth );
3035-
SetHealth( iMaxHealth );
3038+
if (GetMaxHealth() != iMaxHealth)
3039+
{
3040+
SetMaxHealth(iMaxHealth);
3041+
SetHealth(iMaxHealth);
3042+
}
30363043
}
30373044

30383045
const char *pUpgradeSound = GetObjectInfo( ObjectType() )->m_pUpgradeSound;
@@ -3615,6 +3622,8 @@ void CBaseObject::MakeCarriedObject( CTFPlayer *pCarrier )
36153622
{
36163623
if ( pCarrier )
36173624
{
3625+
// MCOMS_BALANCE_PACK
3626+
36183627
// Make the object inactive.
36193628
m_bCarried = true;
36203629
m_bCarryDeploy = false;
@@ -3819,7 +3828,7 @@ int CBaseObject::GetMaxHealthForCurrentLevel( void )
38193828

38203829
if ( !IsMiniBuilding() && ( GetUpgradeLevel() > 1 ) )
38213830
{
3822-
float flMultiplier = pow( UPGRADE_LEVEL_HEALTH_MULTIPLIER, GetUpgradeLevel() - 1 );
3831+
float flMultiplier = pow( UPGRADE_LEVEL_HEALTH_MULTIPLIER, MIN(GetUpgradeLevel(), OBJ_MAX_UPGRADE_LEVEL) - 1 );
38233832
iMaxHealth = (int)( iMaxHealth * flMultiplier );
38243833
}
38253834

src/game/server/tf/tf_obj.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ class CBaseObject : public CBaseCombatCharacter, public IHasBuildPoints, public
211211
virtual void OnGoInactive( void );
212212

213213
// Disabling
214-
bool IsDisabled( void ) { return m_bDisabled || m_bCarried; }
214+
bool ShouldBeActiveWhileCarried() const
215+
{
216+
// Dispenser active while carried
217+
return m_iObjectType == OBJ_DISPENSER;
218+
}
219+
bool IsDisabled( void ) { return m_bDisabled || m_bCarried && !ShouldBeActiveWhileCarried(); }
215220
virtual void UpdateDisabledState( void );
216221
void SetDisabled( bool bDisabled );
217222
virtual void OnStartDisabled( void );

0 commit comments

Comments
 (0)