From 94ab311676691d7240bef988d4a6e25320bc0f48 Mon Sep 17 00:00:00 2001 From: Dinorush Date: Mon, 24 Jan 2022 19:07:22 -0500 Subject: Adds titan e-smoke to the core build bar --- .../vscripts/earn_meter/sv_earn_meter_mp.gnut | 51 +++++++++++++++++----- 1 file changed, 40 insertions(+), 11 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index 4417168a..12423e6b 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -71,14 +71,36 @@ void function OnPlayerRespawned( entity player ) EarnMeterMP_BoostEarned( player ) } +void function EarnMeterMP_ReplaceReward( entity player, EarnObject reward, float rewardFrac ) +{ + PlayerEarnMeter_Reset( player ) + PlayerEarnMeter_SetReward( player, reward ) + PlayerEarnMeter_SetRewardFrac( player, rewardFrac ) + + if( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) + PlayerEarnMeter_EnableReward( player ) +} + void function EarnMeterMP_PlayerLifeThink( entity player ) { player.EndSignal( "OnDeath" ) player.EndSignal( "OnDestroy" ) + EarnObject pilotReward + float pilotRewardFrac int lastEarnMeterMode = PlayerEarnMeter_GetMode( player ) float lastPassiveGainTime = Time() + OnThreadEnd( + function() : ( player, pilotReward, pilotRewardFrac ) + { + // Resets the meter to the pilot version if the player dies in a titan (otherwise pilot gets e-smoke earn meter, which is bad) + int earnMode = PlayerEarnMeter_GetMode( player ) + if( earnMode == eEarnMeterMode.CORE || earnMode == eEarnMeterMode.CORE_ACTIVE ) + EarnMeterMP_ReplaceReward( player, pilotReward, pilotRewardFrac ) + } + ) + while ( true ) { int desiredEarnMeterMode @@ -99,25 +121,28 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) if ( desiredEarnMeterMode != lastEarnMeterMode ) { PlayerEarnMeter_SetMode( player, desiredEarnMeterMode ) + if ( lastEarnMeterMode == eEarnMeterMode.DEFAULT ) // Set these here in case the player changed boost during the match (e.g. in dropship) + { + pilotReward = PlayerEarnMeter_GetReward( player ) + pilotRewardFrac = PlayerEarnMeter_GetRewardFrac( player ) + } if ( desiredEarnMeterMode == eEarnMeterMode.DEFAULT ) { if ( !IsTitanAvailable( player ) && PlayerEarnMeter_GetOwnedFrac( player ) == 1.0 ) // this should only be the case after player has dropped their titan - { - float oldRewardFrac = PlayerEarnMeter_GetRewardFrac( player ) - PlayerEarnMeter_Reset( player ) - PlayerEarnMeter_SetRewardFrac( player, oldRewardFrac ) - PlayerEarnMeter_EnableReward( player ) - } + EarnMeterMP_ReplaceReward( player, pilotReward, pilotRewardFrac ) if ( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) PlayerEarnMeter_EnableReward( player ) } - else - { - PlayerEarnMeter_DisableGoal( player ) - PlayerEarnMeter_DisableReward( player ) - } + else if ( desiredEarnMeterMode == eEarnMeterMode.CORE ) + { + EarnMeterMP_ReplaceReward( player, EarnObject_GetByRef( "core_electric_smoke" ), CORE_SMOKE_FRAC ) + if( SoulTitanCore_GetNextAvailableTime( player.GetTitanSoul() ) >= CORE_SMOKE_FRAC ) + PlayerEarnMeter_SetRewardUsed( player ) + } + else if ( desiredEarnMeterMode == eEarnMeterMode.CORE_ACTIVE ) // Enables smoke after core use (doesn't show up during active, so looks fine) + PlayerEarnMeter_EnableReward( player ) lastEarnMeterMode = desiredEarnMeterMode } @@ -148,6 +173,10 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) void function EarnMeterMP_BoostEarned( entity player ) { + // Can't have smoke earned via meter. Otherwise, Auto Titan could hit reward frac and get nothing + if( player.IsTitan() ) + return + EarnObject earnobject = PlayerEarnMeter_GetReward( player ) BurnReward burncard = BurnReward_GetByRef( earnobject.ref ) -- cgit v1.2.3 From b347b644ce26a5b027c2ec467c21307157a004d5 Mon Sep 17 00:00:00 2001 From: Dinorush Date: Mon, 24 Jan 2022 19:10:33 -0500 Subject: Change indentation to tabs --- .../vscripts/earn_meter/sv_earn_meter_mp.gnut | 64 +++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index 12423e6b..58cd15c2 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -73,12 +73,12 @@ void function OnPlayerRespawned( entity player ) void function EarnMeterMP_ReplaceReward( entity player, EarnObject reward, float rewardFrac ) { - PlayerEarnMeter_Reset( player ) - PlayerEarnMeter_SetReward( player, reward ) - PlayerEarnMeter_SetRewardFrac( player, rewardFrac ) + PlayerEarnMeter_Reset( player ) + PlayerEarnMeter_SetReward( player, reward ) + PlayerEarnMeter_SetRewardFrac( player, rewardFrac ) - if( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) - PlayerEarnMeter_EnableReward( player ) + if( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) + PlayerEarnMeter_EnableReward( player ) } void function EarnMeterMP_PlayerLifeThink( entity player ) @@ -86,20 +86,20 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) player.EndSignal( "OnDeath" ) player.EndSignal( "OnDestroy" ) - EarnObject pilotReward - float pilotRewardFrac + EarnObject pilotReward + float pilotRewardFrac int lastEarnMeterMode = PlayerEarnMeter_GetMode( player ) float lastPassiveGainTime = Time() - OnThreadEnd( - function() : ( player, pilotReward, pilotRewardFrac ) - { - // Resets the meter to the pilot version if the player dies in a titan (otherwise pilot gets e-smoke earn meter, which is bad) - int earnMode = PlayerEarnMeter_GetMode( player ) - if( earnMode == eEarnMeterMode.CORE || earnMode == eEarnMeterMode.CORE_ACTIVE ) - EarnMeterMP_ReplaceReward( player, pilotReward, pilotRewardFrac ) - } - ) + OnThreadEnd( + function() : ( player, pilotReward, pilotRewardFrac ) + { + // Resets the meter to the pilot version if the player dies in a titan (otherwise pilot gets e-smoke earn meter, which is bad) + int earnMode = PlayerEarnMeter_GetMode( player ) + if( earnMode == eEarnMeterMode.CORE || earnMode == eEarnMeterMode.CORE_ACTIVE ) + EarnMeterMP_ReplaceReward( player, pilotReward, pilotRewardFrac ) + } + ) while ( true ) { @@ -121,11 +121,11 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) if ( desiredEarnMeterMode != lastEarnMeterMode ) { PlayerEarnMeter_SetMode( player, desiredEarnMeterMode ) - if ( lastEarnMeterMode == eEarnMeterMode.DEFAULT ) // Set these here in case the player changed boost during the match (e.g. in dropship) - { - pilotReward = PlayerEarnMeter_GetReward( player ) - pilotRewardFrac = PlayerEarnMeter_GetRewardFrac( player ) - } + if ( lastEarnMeterMode == eEarnMeterMode.DEFAULT ) // Set these here in case the player changed boost during the match (e.g. in dropship) + { + pilotReward = PlayerEarnMeter_GetReward( player ) + pilotRewardFrac = PlayerEarnMeter_GetRewardFrac( player ) + } if ( desiredEarnMeterMode == eEarnMeterMode.DEFAULT ) { @@ -135,14 +135,14 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) if ( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) PlayerEarnMeter_EnableReward( player ) } - else if ( desiredEarnMeterMode == eEarnMeterMode.CORE ) - { - EarnMeterMP_ReplaceReward( player, EarnObject_GetByRef( "core_electric_smoke" ), CORE_SMOKE_FRAC ) - if( SoulTitanCore_GetNextAvailableTime( player.GetTitanSoul() ) >= CORE_SMOKE_FRAC ) - PlayerEarnMeter_SetRewardUsed( player ) - } - else if ( desiredEarnMeterMode == eEarnMeterMode.CORE_ACTIVE ) // Enables smoke after core use (doesn't show up during active, so looks fine) - PlayerEarnMeter_EnableReward( player ) + else if ( desiredEarnMeterMode == eEarnMeterMode.CORE ) + { + EarnMeterMP_ReplaceReward( player, EarnObject_GetByRef( "core_electric_smoke" ), CORE_SMOKE_FRAC ) + if( SoulTitanCore_GetNextAvailableTime( player.GetTitanSoul() ) >= CORE_SMOKE_FRAC ) + PlayerEarnMeter_SetRewardUsed( player ) + } + else if ( desiredEarnMeterMode == eEarnMeterMode.CORE_ACTIVE ) // Enables smoke after core use (doesn't show up during active, so looks fine) + PlayerEarnMeter_EnableReward( player ) lastEarnMeterMode = desiredEarnMeterMode } @@ -173,9 +173,9 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) void function EarnMeterMP_BoostEarned( entity player ) { - // Can't have smoke earned via meter. Otherwise, Auto Titan could hit reward frac and get nothing - if( player.IsTitan() ) - return + // Can't have smoke earned via meter. Otherwise, Auto Titan could hit reward frac and get nothing + if( player.IsTitan() ) + return EarnObject earnobject = PlayerEarnMeter_GetReward( player ) BurnReward burncard = BurnReward_GetByRef( earnobject.ref ) -- cgit v1.2.3 From 55e00cd6a0c12b4fe227553b3e173e73140c19e7 Mon Sep 17 00:00:00 2001 From: Dinorush Date: Mon, 24 Jan 2022 22:14:06 -0500 Subject: Fix ejects failing to reassign reward. Reset passive gain when titan dies. --- .../mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Northstar.CustomServers/mod/scripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index 58cd15c2..ff25b6a9 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -129,8 +129,11 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) if ( desiredEarnMeterMode == eEarnMeterMode.DEFAULT ) { - if ( !IsTitanAvailable( player ) && PlayerEarnMeter_GetOwnedFrac( player ) == 1.0 ) // this should only be the case after player has dropped their titan + if ( !IsTitanAvailable( player ) && lastEarnMeterMode == eEarnMeterMode.PET ) // this should only be the case after player's auto died (or they ejected) + { + lastPassiveGainTime = Time() EarnMeterMP_ReplaceReward( player, pilotReward, pilotRewardFrac ) + } if ( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) PlayerEarnMeter_EnableReward( player ) -- cgit v1.2.3 From 644b4756281eaa29d7c9c35471f25fc3283e1288 Mon Sep 17 00:00:00 2001 From: Dinorush <62536724+Dinorush@users.noreply.github.com> Date: Mon, 24 Jan 2022 23:11:19 -0500 Subject: Reverted passive gain ticking after titan death --- .../mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index ff25b6a9..91f17a66 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -130,10 +130,7 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) if ( desiredEarnMeterMode == eEarnMeterMode.DEFAULT ) { if ( !IsTitanAvailable( player ) && lastEarnMeterMode == eEarnMeterMode.PET ) // this should only be the case after player's auto died (or they ejected) - { - lastPassiveGainTime = Time() EarnMeterMP_ReplaceReward( player, pilotReward, pilotRewardFrac ) - } if ( PlayerEarnMeter_GetRewardFrac( player ) != 0 ) PlayerEarnMeter_EnableReward( player ) @@ -230,4 +227,4 @@ void function EarnMeterMP_SetBoostByRef( entity player, string boostRef ) } else PlayerEarnMeter_SetGoal( player, earnobject ) -} \ No newline at end of file +} -- cgit v1.2.3 From 0da60a2aab64cf83f08b38c1a6ab9b20d0283fa5 Mon Sep 17 00:00:00 2001 From: Dinorush <62536724+Dinorush@users.noreply.github.com> Date: Wed, 26 Jan 2022 02:51:05 -0500 Subject: Fix to invalid earnObject id on titan death --- .../mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Northstar.CustomServers/mod/scripts') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut index 91f17a66..33e380d5 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/earn_meter/sv_earn_meter_mp.gnut @@ -74,6 +74,8 @@ void function OnPlayerRespawned( entity player ) void function EarnMeterMP_ReplaceReward( entity player, EarnObject reward, float rewardFrac ) { PlayerEarnMeter_Reset( player ) + if ( reward.id < 0 ) // Don't set the reward if it is nonexistent + return PlayerEarnMeter_SetReward( player, reward ) PlayerEarnMeter_SetRewardFrac( player, rewardFrac ) @@ -86,8 +88,8 @@ void function EarnMeterMP_PlayerLifeThink( entity player ) player.EndSignal( "OnDeath" ) player.EndSignal( "OnDestroy" ) - EarnObject pilotReward - float pilotRewardFrac + EarnObject pilotReward = PlayerEarnMeter_GetReward( player ) + float pilotRewardFrac = PlayerEarnMeter_GetRewardFrac( player ) int lastEarnMeterMode = PlayerEarnMeter_GetMode( player ) float lastPassiveGainTime = Time() -- cgit v1.2.3