Skip to content

Commit

Permalink
Merge branch 'main' into tbshotgun_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zanieon authored Jun 29, 2024
2 parents d230c45 + 6581c4e commit ff32cec
Show file tree
Hide file tree
Showing 20 changed files with 535 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/encoding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
check-loc-encoding:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -12,7 +12,7 @@ jobs:
files=$(ls Northstar.Client/mod/resource/northstar_client_localisation_*.txt)
IFS=$'\n'; files=($files); unset IFS; ! file --mime "${files[@]}" | grep -v "charset=utf-16le"
check-missing-translations:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
16 changes: 16 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/_xp.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ void function SetupPlayerPreviousXPValues( entity player )
player.SetPersistentVar( "previousFactionXP[" + xpFaction + "]", FactionGetXP( player, xpFaction ) )

foreach ( string xpTitan in shTitanXP.titanClasses )
{
player.SetPersistentVar( "previousTitanXP[" + xpTitan + "]", TitanGetXP( player, xpTitan ) )
player.SetPersistentVar( "fdPreviousTitanXP[" + xpTitan + "]", FD_TitanGetXP( player, xpTitan ) )
}

foreach ( string xpWeapon in shWeaponXP.weaponClassNames )
player.SetPersistentVar( GetItemPersistenceStruct( xpWeapon ) + ".previousWeaponXP", WeaponGetXP( player, xpWeapon ) )
Expand All @@ -35,6 +38,14 @@ void function HandleXPGainForScoreEvent( entity player, ScoreEvent event )
int weaponXp = ScoreEvent_GetXPValueWeapon( event )
int titanXp = ScoreEvent_GetXPValueTitan( event )
int factionXp = ScoreEvent_GetXPValueFaction( event )

if ( player.GetPlayerNetInt( "xpMultiplier" ) > 0 || GetCurrentPlaylistVarInt( "double_xp_enabled", 0 ) == 1 )
{
xpValue *= 2
weaponXp *= 2
titanXp *= 2
factionXp *= 2
}

entity weapon = player.GetActiveWeapon()
if ( IsValid( weapon ) && ShouldTrackXPForWeapon( weapon.GetWeaponClassName() ) && weaponXp != 0 )
Expand Down Expand Up @@ -63,5 +74,10 @@ void function AddXP( entity player, int amount )
int newXp = player.GetPersistentVarAsInt( "xp" )
int newLevel = GetLevelForXP( newXp )
if ( newLevel != oldLevel )
{
Remote_CallFunction_NonReplay( player, "ServerCallback_PlayerLeveledUp", player.GetPersistentVarAsInt( "gen" ), newLevel )

if( ProgressionEnabledForPlayer( player ) )
AwardRandomItemsForPlayerLevels( player, player.GetPersistentVarAsInt( "gen" ), newLevel )
}
}
10 changes: 10 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/evac/_evac.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
SetTeamActiveObjective( evacTeam, "EG_DropshipExtract", Time() + arrivalTime, file.evacIcon )
SetTeamActiveObjective( GetOtherTeam( evacTeam ), "EG_StopExtract", Time() + arrivalTime, file.evacIcon )

foreach( entity player in GetPlayerArrayOfTeam( evacTeam ) ) //Show the Evac Match Goal for players of the team that lost the match
Remote_CallFunction_UI( player, "SCB_SetEvacMeritState", 0 )

// would've liked to use cd_dropship_rescue_side_start length here, but can't since this is done before dropship spawn, can't
wait arrivalTime - 4.33333

Expand Down Expand Up @@ -280,6 +283,9 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
{
SetTeamActiveObjective( evacTeam, "EG_DropshipExtractDropshipDestroyed" )
SetTeamActiveObjective( GetOtherTeam( evacTeam ), "EG_DropshipExtractDropshipDestroyed" )

foreach( entity player in GetPlayerArrayOfTeam( evacTeam ) )
SetPlayerChallengeEvacState( player, 0 )
}

foreach ( entity player in dropship.s.evacSlots )
Expand Down Expand Up @@ -402,7 +408,10 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
if ( !PlayerInDropship( player, dropship ) )
{
if ( player.GetTeam() == dropship.GetTeam() )
{
SetPlayerActiveObjective( player, "EG_DropshipExtractFailedEscape" )
SetPlayerChallengeEvacState( player, 2 )
}

continue
}
Expand All @@ -417,6 +426,7 @@ void function Evac( int evacTeam, float initialWait, float arrivalTime, float wa
Remote_CallFunction_NonReplay( player, "ServerCallback_DisableHudForEvac" )
Remote_CallFunction_NonReplay( player, "ServerCallback_SetClassicSkyScale", dropship.GetEncodedEHandle(), 0.7 )
Remote_CallFunction_NonReplay( player, "ServerCallback_SetMapSettings", 4.0, false, 0.4, 0.125 )
SetPlayerChallengeEvacState( player, 1 )

// display player [Evacuated] in killfeed
foreach ( entity otherPlayer in GetPlayerArray() )
Expand Down
9 changes: 9 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/faction_xp.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,19 @@ void function AddFactionXP( entity player, int amount )
{
string faction = GetFactionChoice( player )
int oldLevel = FactionGetLevel( player, faction )
int FactionXPMatch = player.GetPersistentVarAsInt( "xp_match[" + XP_TYPE.FACTION_LEVELED + "]" )

// increment xp
player.SetPersistentVar( "factionXP[" + faction + "]", min( FactionGetXP( player, faction ) + amount, FactionGetMaxXP( faction ) ) )

// note: no notif for faction level up
if ( FactionGetLevel( player, faction ) != oldLevel )
{
AddPlayerScore( player, "FactionLevelUp" )
IncrementPlayerChallengeFactionLeveledUp( player )
player.SetPersistentVar( "xp_match[" + XP_TYPE.FACTION_LEVELED + "]", FactionXPMatch + 1 )

if( ProgressionEnabledForPlayer( player ) )
AwardRandomItemsForFactionLevels( player, faction, oldLevel, FactionGetLevel( player, faction ) )
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void function GamemodeAITdm_Init()
}

ScoreEvent_SetupEarnMeterValuesForMixedModes()
SetupGenericTDMChallenge()
}

// add settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ void function AT_PlayerTitleThink( entity player )
{
// Set player money count
player.SetTitle( "$" + string( AT_GetPlayerBonusPoints( player ) ) )

if( AT_GetPlayerBonusPoints( player ) >= 600 && !HasPlayerCompletedMeritScore( player ) ) //Challenge is: "Earn $600."
{
AddPlayerScore( player, "ChallengeATAssault" )
SetPlayerChallengeMeritScore( player )
}
}
else if ( GetGameState() >= eGameState.WinnerDetermined )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ struct {

array<HardpointStruct> hardpoints
array<CP_PlayerStruct> players
table<entity,int> playerAssaultPoints
table<entity,int> playerDefensePoints
} file

void function GamemodeCP_Init()
Expand Down Expand Up @@ -112,11 +114,13 @@ void function GamemodeCP_OnPlayerKilled(entity victim, entity attacker, var dama
{
AddPlayerScore( attacker , "HardpointDefense", victim )
attacker.AddToPlayerGameStat(PGS_DEFENSE_SCORE,POINTVALUE_HARDPOINT_DEFENSE)
UpdatePlayerScoreForChallenge(attacker,0,POINTVALUE_HARDPOINT_DEFENSE)
}
else if((victimCP.hardpoint.GetTeam()==victim.GetTeam())||(GetHardpointCappingTeam(victimCP)==victim.GetTeam()))
{
AddPlayerScore( attacker, "HardpointAssault", victim )
attacker.AddToPlayerGameStat(PGS_ASSAULT_SCORE,POINTVALUE_HARDPOINT_ASSAULT)
UpdatePlayerScoreForChallenge(attacker,POINTVALUE_HARDPOINT_ASSAULT,0)
}
}
}
Expand All @@ -127,17 +131,20 @@ void function GamemodeCP_OnPlayerKilled(entity victim, entity attacker, var dama
{
AddPlayerScore( attacker , "HardpointSnipe", victim )
attacker.AddToPlayerGameStat(PGS_ASSAULT_SCORE,POINTVALUE_HARDPOINT_SNIPE)
UpdatePlayerScoreForChallenge(attacker,POINTVALUE_HARDPOINT_SNIPE,0)
}
else{
AddPlayerScore( attacker , "HardpointSiege", victim )
attacker.AddToPlayerGameStat(PGS_ASSAULT_SCORE,POINTVALUE_HARDPOINT_SIEGE)
UpdatePlayerScoreForChallenge(attacker,POINTVALUE_HARDPOINT_SIEGE,0)
}
}
else if(attackerCP.hardpoint!=null)//Perimeter Defense
{
if(attackerCP.hardpoint.GetTeam()==attacker.GetTeam())
AddPlayerScore( attacker , "HardpointPerimeterDefense", victim)
attacker.AddToPlayerGameStat(PGS_DEFENSE_SCORE,POINTVALUE_HARDPOINT_PERIMETER_DEFENSE)
UpdatePlayerScoreForChallenge(attacker,0,POINTVALUE_HARDPOINT_PERIMETER_DEFENSE)
}

foreach(CP_PlayerStruct player in file.players) //Reset Victim Holdtime Counter
Expand Down Expand Up @@ -308,6 +315,7 @@ void function CapturePointForTeam(HardpointStruct hardpoint, int Team)
if(player.IsPlayer()){
AddPlayerScore(player,"ControlPointCapture")
player.AddToPlayerGameStat(PGS_ASSAULT_SCORE,POINTVALUE_HARDPOINT_CAPTURE)
UpdatePlayerScoreForChallenge(player,POINTVALUE_HARDPOINT_CAPTURE,0)
}
}
}
Expand All @@ -319,12 +327,17 @@ void function GamemodeCP_InitPlayer(entity player)
playerStruct.timeOnPoints = [0.0,0.0,0.0]
playerStruct.isOnHardpoint = false
file.players.append(playerStruct)
file.playerAssaultPoints[player] <- 0
file.playerDefensePoints[player] <- 0
thread PlayerThink(playerStruct)
}

void function GamemodeCP_RemovePlayer(entity player)
{

if(player in file.playerAssaultPoints)
delete file.playerAssaultPoints[player]
if(player in file.playerDefensePoints)
delete file.playerDefensePoints[player]
foreach(index,CP_PlayerStruct playerStruct in file.players)
{
if(playerStruct.player==player)
Expand Down Expand Up @@ -376,11 +389,13 @@ void function PlayerThink(CP_PlayerStruct player)
{
AddPlayerScore(player.player,"ControlPointAmpedHold")
player.player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, POINTVALUE_HARDPOINT_AMPED_HOLD )
UpdatePlayerScoreForChallenge(player.player,0,POINTVALUE_HARDPOINT_AMPED_HOLD)
}
else
{
AddPlayerScore(player.player,"ControlPointHold")
player.player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, POINTVALUE_HARDPOINT_HOLD )
UpdatePlayerScoreForChallenge(player.player,0,POINTVALUE_HARDPOINT_HOLD)
}
}
break
Expand Down Expand Up @@ -574,6 +589,7 @@ void function HardpointThink( HardpointStruct hardpoint )
{
AddPlayerScore(player,"ControlPointAmped")
player.AddToPlayerGameStat(PGS_DEFENSE_SCORE,POINTVALUE_HARDPOINT_AMPED)
UpdatePlayerScoreForChallenge(player,0,POINTVALUE_HARDPOINT_AMPED)
}
}
}
Expand Down Expand Up @@ -714,3 +730,26 @@ string function GetHardpointGroup(entity hardpoint) //Hardpoint Entity B on Home

return string(hardpoint.kv.hardpointGroup)
}

void function UpdatePlayerScoreForChallenge(entity player,int assaultpoints = 0,int defensepoints = 0)
{
if(player in file.playerAssaultPoints)
{
file.playerAssaultPoints[player] += assaultpoints
if( file.playerAssaultPoints[player] >= 1000 && !HasPlayerCompletedMeritScore(player) )
{
AddPlayerScore(player,"ChallengeCPAssault")
SetPlayerChallengeMeritScore(player)
}
}

if(player in file.playerDefensePoints)
{
file.playerDefensePoints[player] += defensepoints
if( file.playerDefensePoints[player] >= 500 && !HasPlayerCompletedMeritScore(player) )
{
AddPlayerScore(player,"ChallengeCPDefense")
SetPlayerChallengeMeritScore(player)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -421,15 +421,28 @@ void function CaptureFlag( entity player, entity flag )
assistList = file.militiaCaptureAssistList

foreach( entity assistPlayer in assistList )
{
if ( player != assistPlayer )
AddPlayerScore( assistPlayer, "FlagCaptureAssist", player )
if( !HasPlayerCompletedMeritScore( assistPlayer ) )
{
AddPlayerScore( assistPlayer, "ChallengeCTFCapAssist" )
SetPlayerChallengeMeritScore( assistPlayer )
}
}

assistList.clear()

// notifs
MessageToPlayer( player, eEventNotifications.YouCapturedTheEnemyFlag )
EmitSoundOnEntityOnlyToPlayer( player, player, "UI_CTF_1P_PlayerScore" )

if( !HasPlayerCompletedMeritScore( player ) )
{
AddPlayerScore( player, "ChallengeCTFRetAssist" )
SetPlayerChallengeMeritScore( player )
}

MessageToTeam( team, eEventNotifications.PlayerCapturedEnemyFlag, player, player )
EmitSoundOnEntityToTeamExceptPlayer( flag, "UI_CTF_3P_TeamScore", player.GetTeam(), player )

Expand Down Expand Up @@ -503,6 +516,12 @@ void function TryReturnFlag( entity player, entity flag )
AddPlayerScore( player, "FlagReturn", player )
player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, 1 )

if( !HasPlayerCompletedMeritScore( player ) )
{
AddPlayerScore( player, "ChallengeCTFRetAssist" )
SetPlayerChallengeMeritScore( player )
}

MessageToTeam( flag.GetTeam(), eEventNotifications.PlayerReturnedFriendlyFlag, null, player )
EmitSoundOnEntityToTeam( flag, "UI_CTF_3P_TeamReturnsFlag", flag.GetTeam() )
PlayFactionDialogueToTeam( "ctf_flagReturnedFriendly", flag.GetTeam() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void function GamemodeFRA_Init()
ScoreEvent_SetEarnMeterValues( "PilotBatteryPickup", 0.0, 0.34 )
EarnMeterMP_SetPassiveMeterGainEnabled( false )
PilotBattery_SetMaxCount( 3 )
SetupGenericFFAChallenge()

AddCallback_OnPlayerKilled( FRARemoveEarnMeter )
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ struct {
float lastDamageInfoTime

bool shouldDoHighlights

table< entity, int > pilotstreak
} file

void function GamemodeLts_Init()
Expand All @@ -34,6 +36,37 @@ void function GamemodeLts_Init()
ClassicMP_SetCustomIntro( ClassicMP_DefaultNoIntro_Setup, ClassicMP_DefaultNoIntro_GetLength() )
ClassicMP_ForceDisableEpilogue( true )
AddCallback_GameStateEnter( eGameState.Playing, WaitForThirtySecondsLeft )

AddCallback_OnClientConnected( SetupPlayerLTSChallenges ) //Just to make up the Match Goals tracking
AddCallback_OnClientDisconnected( RemovePlayerLTSChallenges ) //Safety removal of data to prevent crashes
AddCallback_OnPlayerKilled( LTSChallengeForPlayerKilled )
}

void function SetupPlayerLTSChallenges( entity player )
{
file.pilotstreak[ player ] <- 0
}

void function RemovePlayerLTSChallenges( entity player )
{
if( player in file.pilotstreak )
delete file.pilotstreak[ player ]
}

void function LTSChallengeForPlayerKilled( entity victim, entity attacker, var damageInfo )
{
if ( victim == attacker || !attacker.IsPlayer() || GetGameState() != eGameState.Playing )
return

if ( victim.IsPlayer() && attacker in file.pilotstreak )
{
file.pilotstreak[attacker]++
if( file.pilotstreak[attacker] >= 2 && !HasPlayerCompletedMeritScore( attacker ) )
{
AddPlayerScore( attacker, "ChallengeLTS" )
SetPlayerChallengeMeritScore( attacker )
}
}
}

void function WaitForThirtySecondsLeft()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ void function MarkPlayers( entity imcMark, entity militiaMark )
entity livingMark = GetMarked( GetOtherTeam( deadMark.GetTeam() ) )
livingMark.SetPlayerGameStat( PGS_DEFENSE_SCORE, livingMark.GetPlayerGameStat( PGS_DEFENSE_SCORE ) + 1 )

if( !HasPlayerCompletedMeritScore( livingMark ) )
{
AddPlayerScore( livingMark, "ChallengeMFD" )
SetPlayerChallengeMeritScore( livingMark )
}

// thread this so we don't kill our own thread
thread AddTeamScore( livingMark.GetTeam(), 1 )
}
Expand All @@ -195,8 +201,15 @@ void function UpdateMarksForKill( entity victim, entity attacker, var damageInfo

MessageToAll( eEventNotifications.MarkedForDeathKill, null, victim, actualAttacker.GetEncodedEHandle() )
svGlobal.levelEnt.Signal( "MarkKilled", { mark = victim } )

if ( !isSuicide && attacker.IsPlayer() )
{
attacker.SetPlayerGameStat( PGS_ASSAULT_SCORE, attacker.GetPlayerGameStat( PGS_ASSAULT_SCORE ) + 1 )
if( !HasPlayerCompletedMeritScore( attacker ) )
{
AddPlayerScore( attacker, "ChallengeMFD" )
SetPlayerChallengeMeritScore( attacker )
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ void function GamemodePs_Init()
AddCallback_OnPlayerKilled( GiveScoreForPlayerKill )
ScoreEvent_SetupEarnMeterValuesForMixedModes()
SetTimeoutWinnerDecisionFunc( CheckScoreForDraw )
SetupGenericFFAChallenge()

// spawnzone stuff
SetShouldCreateMinimapSpawnZones( true )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void function GamemodeSpeedball_Init()
Riff_ForceTitanAvailability( eTitanAvailability.Never )
Riff_ForceSetEliminationMode( eEliminationMode.Pilots )
ScoreEvent_SetupEarnMeterValuesForMixedModes()
SetupGenericFFAChallenge()

AddSpawnCallbackEditorClass( "script_ref", "info_speedball_flag", CreateFlag )

Expand Down
Loading

0 comments on commit ff32cec

Please sign in to comment.