Skip to content

Commit

Permalink
Merge branch 'main' into unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GeckoEidechse authored Nov 15, 2023
2 parents 873144d + a937566 commit afcfd02
Show file tree
Hide file tree
Showing 16 changed files with 127 additions and 108 deletions.
14 changes: 1 addition & 13 deletions .github/nativefuncs.json
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,7 @@
"helpText":"Returns whether or not a given path leads to a folder.",
"returnTypeString":"bool",
"argTypes":"string path"
},
{
"name":"NSPushGameStateData",
"helpText":"",
"returnTypeString":"void",
"argTypes":"struct gamestate"
}
}
],
"UI":[
{
Expand Down Expand Up @@ -724,12 +718,6 @@
"returnTypeString":"bool",
"argTypes":"string path"
},
{
"name":"NSPushUIPresence",
"helpText":"",
"returnTypeString":"void",
"argTypes":"struct presence"
},
{
"name":"NSGetMasterServerAuthResult",
"helpText":"",
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/add-to-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
issues:
types:
- opened
pull_request_target:
types:
- opened

jobs:
add-to-project:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,9 @@ Choisissez Oui si vous êtes d'accord. Ce choix peut être modifié à tout inst
"TOGGLE_PROGRESSION" "Activer la progression"
"Y_BUTTON_TOGGLE_PROGRESSION" "%[Y_BUTTON|]% Activer la progression"
"PROGRESSION_ANNOUNCEMENT_BODY" "^CCCC0000Le système de progression peut être activé !^\n\nNorthstar supporte désormais le système de progression du jeu original, vous permettant de choisir si vous souhaitez débloquer les armes, skins, titans etc. en gagnant des niveaux et en complétant des défis.\n\nVous pouvez activer la progression en utilisant le bouton en bas de l'écran d'accueil.\n\nCeci peut être changé à tout moment."
"AUTHENTICATION_FAILED_HEADER" "Échec de l'authentification"
"AUTHENTICATION_FAILED_HELP" "Aide"
"AUTHENTICATION_FAILED_ERROR_CODE" "Code d'erreur : ^DB6F2C00%s1^"
"AUTHENTICATION_FAILED_BODY" "L'authentification avec Atlas a échoué."
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
global enum eDiscordGameState
{
LOADING = 0
MAINMENU
LOBBY
INGAME
}

global struct GameStateStruct {

string map
Expand All @@ -15,10 +23,7 @@ global struct GameStateStruct {
}

global struct UIPresenceStruct {
bool isLoading
bool isLobby
string loadingLevel
string loadedLevel
int gameState
}

global struct RequiredModInfo
Expand Down
11 changes: 4 additions & 7 deletions Northstar.Client/mod/scripts/vscripts/presence/cl_presence.nut
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
untyped
globalize_all_functions

void function NorthstarCodeCallback_GenerateGameState() {

GameStateStruct gs

GameStateStruct function DiscordRPC_GenerateGameState( GameStateStruct gs )
{
int highestScore = 0
int secondHighest = 0

Expand Down Expand Up @@ -40,6 +38,5 @@ void function NorthstarCodeCallback_GenerateGameState() {
gs.timeEnd = expect float(level.nv.roundEndTime - Time())
else
gs.timeEnd = expect float(level.nv.gameEndTime - Time())

NSPushGameStateData(gs)
}
return gs
}
20 changes: 12 additions & 8 deletions Northstar.Client/mod/scripts/vscripts/presence/ui_presence.nut
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
untyped
globalize_all_functions

void function NorthstarCodeCallback_GenerateUIPresence() {
UIPresenceStruct uis
UIPresenceStruct function DiscordRPC_GenerateUIPresence( UIPresenceStruct uis )
{
if ( uiGlobal.isLoading )
uis.gameState = eDiscordGameState.LOADING;
else if ( uiGlobal.loadedLevel == "" )
uis.gameState = eDiscordGameState.MAINMENU;
else if ( IsLobby() || uiGlobal.loadedLevel == "mp_lobby" )
uis.gameState = eDiscordGameState.LOBBY;
else
uis.gameState = eDiscordGameState.INGAME;

uis.isLoading = uiGlobal.isLoading
uis.isLobby = IsLobby()
uis.loadingLevel = uiGlobal.loadingLevel
uis.loadedLevel = uiGlobal.loadedLevel
NSPushUIPresence(uis)
}
return uis
}
11 changes: 7 additions & 4 deletions Northstar.Client/mod/scripts/vscripts/ui/panel_mainmenu.nut
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ void function InitMainMenuPanel()
headerIndex++
buttonIndex = 0
var multiplayerHeader = AddComboButtonHeader( comboStruct, headerIndex, "#MULTIPLAYER_ALLCAPS" )
file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" )
Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate )
// "Launch Multiplayer" button removed because we don't support vanilla yet :clueless:
//file.mpButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MULTIPLAYER_LAUNCH" )
//Hud_AddEventHandler( file.mpButton, UIE_CLICK, OnPlayMPButton_Activate )
file.fdButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_LAUNCH_NORTHSTAR" )
Hud_AddEventHandler( file.fdButton, UIE_CLICK, OnPlayFDButton_Activate )
Hud_SetLocked( file.fdButton, true )
Expand Down Expand Up @@ -169,7 +170,8 @@ void function OnShowMainMenuPanel()
#endif // PS4_PROG

UpdateSPButtons()
thread UpdatePlayButton( file.mpButton )
// dont try and update the launch multiplayer button, because it doesn't exist
//thread UpdatePlayButton( file.mpButton )
thread UpdatePlayButton( file.fdButton )
thread MonitorTrialVersionChange()

Expand Down Expand Up @@ -459,7 +461,8 @@ void function UpdatePlayButton( var button )
message = ""
}

ComboButton_SetText( file.mpButton, buttonText )
// dont try and update the launch multiplayer button, because it doesn't exist
//ComboButton_SetText( file.mpButton, buttonText )

ComboButton_SetText( file.fdButton, "#MENU_LAUNCH_NORTHSTAR" )
//Hud_SetEnabled( file.fdButton, false )
Expand Down
2 changes: 0 additions & 2 deletions Northstar.Custom/keyvalues/playlists_v2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ playlists
max_teams 12
classic_mp 1

scorelimit 21 // temp until we have a way of dynamically setting non-default scorelimit in code

gamemode_score_hint #GAMEMODE_SCORE_HINT_FFA
gamemode_bullet_001 #GAMEMODE_BULLET_FFA_001
gamemode_bullet_002 #GAMEMODE_BULLET_FFA_002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ void function GamemodeGG_Init()
AddCallback_GameStateEnter( eGameState.WinnerDetermined, OnWinnerDetermined )

AddCallback_GGEarnMeterFull( OnGGEarnMeterFilled )

// set scorelimit if it's wrong, sort of a jank way to do it but best i've got rn
try
{
if ( GetCurrentPlaylistVarInt( "scorelimit", GetGunGameWeapons().len() ) != GetGunGameWeapons().len() )
SetPlaylistVarOverride( "scorelimit", GetGunGameWeapons().len().tostring() )
}
catch ( ex ) {}
}

void function OnPlayerDisconnected(entity player)
Expand Down
62 changes: 22 additions & 40 deletions Northstar.Custom/mod/scripts/vscripts/weapons/_arc_cannon.nut
Original file line number Diff line number Diff line change
Expand Up @@ -536,12 +536,6 @@ function ZapTarget( zapInfo, target, beamStartPos, beamEndPos, chainNum = 1 )
thread CreateArcCannonBeam( zapInfo.weapon, target, beamStartPos, beamEndPos, zapInfo.player, ARC_CANNON_BEAM_LIFETIME, zapInfo.radius, boltWidth, 5, true, firstBeam )

#if SERVER
local isMissile = ( target.GetClassName() == "rpg_missile" )
if ( !isMissile )
wait ARC_CANNON_FORK_DELAY
else
wait 0.05

local deathPackage = damageTypes.arcCannon

float damageAmount
Expand Down Expand Up @@ -569,40 +563,20 @@ function ZapTarget( zapInfo, target, beamStartPos, beamEndPos, chainNum = 1 )
bool hasFastPacitor = false
bool noArcing = false

if ( IsValid( zapInfo.weapon ) )
{
entity weap = expect entity( zapInfo.weapon )
hasFastPacitor = weap.GetWeaponInfoFileKeyField( "push_apart" ) != null && weap.GetWeaponInfoFileKeyField( "push_apart" ) == 1
noArcing = weap.GetWeaponInfoFileKeyField( "no_arcing" ) != null && weap.GetWeaponInfoFileKeyField( "no_arcing" ) == 1
}
entity weapon = expect entity( zapInfo.weapon )
hasFastPacitor = weapon.GetWeaponInfoFileKeyField( "push_apart" ) != null && weapon.GetWeaponInfoFileKeyField( "push_apart" ) == 1
noArcing = weapon.GetWeaponInfoFileKeyField( "no_arcing" ) != null && weapon.GetWeaponInfoFileKeyField( "no_arcing" ) == 1
float critScale = weapon.GetWeaponSettingFloat( eWeaponVar.critical_hit_damage_scale )

if ( target.GetArmorType() == ARMOR_TYPE_HEAVY )
{
if ( IsValid( zapInfo.weapon ) )
{
entity weapon = expect entity( zapInfo.weapon )
damageMin = weapon.GetWeaponSettingInt( damageFarValueTitanArmor )
damageMax = weapon.GetWeaponSettingInt( damageNearValueTitanArmor )
}
else
{
damageMin = 100
damageMax = zapInfo.player.IsNPC() ? 1200 : 800
}
damageMin = weapon.GetWeaponSettingInt( damageFarValueTitanArmor )
damageMax = weapon.GetWeaponSettingInt( damageNearValueTitanArmor )
}
else
{
if ( IsValid( zapInfo.weapon ) )
{
entity weapon = expect entity( zapInfo.weapon )
damageMin = weapon.GetWeaponSettingInt( damageFarValue )
damageMax = weapon.GetWeaponSettingInt( damageNearValue )
}
else
{
damageMin = 120
damageMax = zapInfo.player.IsNPC() ? 140 : 275
}
damageMin = weapon.GetWeaponSettingInt( damageFarValue )
damageMax = weapon.GetWeaponSettingInt( damageNearValue )

if ( target.IsNPC() )
{
Expand All @@ -612,11 +586,10 @@ function ZapTarget( zapInfo, target, beamStartPos, beamEndPos, chainNum = 1 )
}


local chargeRatio = GetArcCannonChargeFraction( zapInfo.weapon )
if ( IsValid( zapInfo.weapon ) && !zapInfo.weapon.GetWeaponSettingBool( eWeaponVar.charge_require_input ) )
local chargeRatio = GetArcCannonChargeFraction( weapon )
if ( !weapon.GetWeaponSettingBool( eWeaponVar.charge_require_input ) )
{
// use distance for damage if the weapon auto-fires
entity weapon = expect entity( zapInfo.weapon )
float nearDist = weapon.GetWeaponSettingFloat( damageNearDistance )
float farDist = weapon.GetWeaponSettingFloat( damageFarDistance )

Expand All @@ -629,10 +602,19 @@ function ZapTarget( zapInfo, target, beamStartPos, beamEndPos, chainNum = 1 )
damageAmount = GraphCapped( zapInfo.chargeFrac, 0, chargeRatio, damageMin, damageMax )
}
local damageFalloff = ARC_CANNON_DAMAGE_FALLOFF_SCALER
if ( IsValid( zapInfo.weapon ) && zapInfo.weapon.HasMod( "splitter" ) )
if ( weapon.HasMod( "splitter" ) )
damageFalloff = SPLITTER_DAMAGE_FALLOFF_SCALER
damageAmount *= pow( damageFalloff, chainNum - 1 )

local isMissile = ( target.GetClassName() == "rpg_missile" )
if ( !isMissile )
wait ARC_CANNON_FORK_DELAY
else
wait 0.05

if ( !IsValid( target ) || !IsValid( zapInfo.player ) )
return

local dmgSourceID = zapInfo.dmgSourceID

// Update Later - This shouldn't be done here, this is not where we determine if damage actually happened to the target
Expand Down Expand Up @@ -660,13 +642,13 @@ function ZapTarget( zapInfo, target, beamStartPos, beamEndPos, chainNum = 1 )
// Do 3rd person effect on the body
asset effect
string tag
target.TakeDamage( damageAmount, zapInfo.player, zapInfo.player, { origin = beamEndPos, force = Vector(0,0,0), scriptType = deathPackage, weapon = zapInfo.weapon, damageSourceId = dmgSourceID,criticalHitScale = zapInfo.weapon.GetWeaponSettingFloat( eWeaponVar.critical_hit_damage_scale ) } )
target.TakeDamage( damageAmount, zapInfo.player, zapInfo.player, { origin = beamEndPos, force = Vector(0,0,0), scriptType = deathPackage, weapon = zapInfo.weapon, damageSourceId = dmgSourceID,criticalHitScale = critScale } )
//vector dir = Normalize( beamEndPos - beamStartPos )
//vector velocity = dir * 600
//PushPlayerAway( target, velocity )
//PushPlayerAway( expect entity( zapInfo.player ), -velocity )

if ( IsValid( zapInfo.weapon ) && hasFastPacitor )
if ( IsValid( weapon ) && hasFastPacitor )
{
if ( IsAlive( target ) && IsAlive( expect entity( zapInfo.player ) ) && target.IsTitan() )
{
Expand Down
4 changes: 4 additions & 0 deletions Northstar.CustomServers/mod/scripts/vscripts/_items.nut
Original file line number Diff line number Diff line change
Expand Up @@ -10231,6 +10231,10 @@ void function StatUnlock_Unlocked( entity player, string itemRef, string parentR
if ( IsItemNew( player, itemRef, parentRef ) )
return

// early out if the player has progression disabled
if ( !ProgressionEnabledForPlayer( player ) )
return

int refGuid = file.itemRefToGuid[itemRef]
int parentRefGuid = parentRef == "" ? 0 : file.itemRefToGuid[parentRef]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
})

entity attacker = DamageInfo_GetAttacker( damageInfo )
entity inflictor = DamageInfo_GetInflictor( damageInfo )
int eHandle = attacker.GetEncodedEHandle()
if ( inflictor && ShouldTryUseProjectileReplay( player, attacker, damageInfo, false ) )
eHandle = inflictor.GetEncodedEHandle()
int methodOfDeath = DamageInfo_GetDamageSourceIdentifier( damageInfo )

table<int, bool> alreadyAssisted
Expand Down Expand Up @@ -374,7 +378,7 @@ void function PostDeathThread_MP( entity player, var damageInfo ) // based on ga
if ( "respawnTime" in attacker.s )
respawnTime = Time() - expect float ( attacker.s.respawnTime )

thread PlayerWatchesKillReplayWrapper( player, attacker, respawnTime, timeOfDeath, beforeTime, replayTracker )
thread PlayerWatchesKillReplayWrapper( player, attacker, eHandle, respawnTime, timeOfDeath, beforeTime, replayTracker )
}

player.SetPlayerSettings( "spectator" ) // prevent a crash with going from titan => pilot on respawn
Expand Down Expand Up @@ -432,7 +436,7 @@ void function ForceRespawnMeSignalAfterDelay( entity player, int delay = 5 )
player.Signal( "RespawnMe" )
}

void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, float timeSinceAttackerSpawned, float timeOfDeath, float beforeTime, table replayTracker )
void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, int eHandle, float timeSinceAttackerSpawned, float timeOfDeath, float beforeTime, table replayTracker )
{
player.EndSignal( "RespawnMe" )
player.EndSignal( "OnRespawned" )
Expand All @@ -455,7 +459,7 @@ void function PlayerWatchesKillReplayWrapper( entity player, entity attacker, fl
})

player.SetPredictionEnabled( false )
PlayerWatchesKillReplay( player, attacker.GetEncodedEHandle(), attacker.GetIndexForEntity(), timeSinceAttackerSpawned, timeOfDeath, beforeTime, replayTracker )
PlayerWatchesKillReplay( player, eHandle, attacker.GetIndexForEntity(), timeSinceAttackerSpawned, timeOfDeath, beforeTime, replayTracker )
}

void function DecideRespawnPlayer( entity player )
Expand Down
Loading

0 comments on commit afcfd02

Please sign in to comment.