aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2023-01-08 02:03:01 +0000
committerGitHub <noreply@github.com>2023-01-08 03:03:01 +0100
commitcad416bc967bc4b902ff5808c0ae3281402d4895 (patch)
tree46bdabc287d0ab324ea642388ef46720934c85db /Northstar.CustomServers
parent560c96d223711ac4f8a1eab7eb2a94531761ef0a (diff)
downloadNorthstarMods-cad416bc967bc4b902ff5808c0ae3281402d4895.tar.gz
NorthstarMods-cad416bc967bc4b902ff5808c0ae3281402d4895.zip
[FD] Allow players to change loadouts between waves (#461)
* Added condition for FD next wave loadout changes * custom function setting for loadout change requests
Diffstat (limited to 'Northstar.CustomServers')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut10
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut7
2 files changed, 16 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut
index 3e8ac9ea..3161237c 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_loadouts_mp.gnut
@@ -3,6 +3,7 @@ global function SvLoadoutsMP_Init
global function SetLoadoutGracePeriodEnabled
global function SetWeaponDropsEnabled
+global function SetAllowLoadoutChangeFunc
global function AddCallback_OnTryGetTitanLoadout
global function GetTitanLoadoutForPlayer
@@ -22,6 +23,8 @@ struct {
array< TryGetTitanLoadoutCallbackType > onTryGetTitanLoadoutCallbacks
array<entity> dirtyLoadouts
+
+ bool functionref( entity ) allowChangeLoadoutFunc = null
} file
void function SvLoadoutsMP_Init()
@@ -60,6 +63,11 @@ void function SetLoadoutGracePeriodEnabled( bool enabled )
file.loadoutGracePeriodEnabled = enabled
}
+void function SetAllowLoadoutChangeFunc( bool functionref( entity ) func )
+{
+ file.allowChangeLoadoutFunc = func
+}
+
void function SetWeaponDropsEnabled( bool enabled )
{
file.weaponDropsEnabled = enabled
@@ -302,7 +310,7 @@ void function TryGivePilotLoadoutForGracePeriod( entity player )
else
respawnTimeReal = expect float( player.s.respawnTime )
- if ( ( ( Time() - respawnTimeReal <= CLASS_CHANGE_GRACE_PERIOD || GetGameState() < eGameState.Playing ) && file.loadoutGracePeriodEnabled ) || player.p.usingLoadoutCrate )
+ if ( ( ( Time() - respawnTimeReal <= CLASS_CHANGE_GRACE_PERIOD || GetGameState() < eGameState.Playing ) && file.loadoutGracePeriodEnabled ) || player.p.usingLoadoutCrate || ( file.allowChangeLoadoutFunc != null && file.allowChangeLoadoutFunc( player ) ) )
{
if ( !Loadouts_CanGivePilotLoadout( player ) && player.GetParent() != null && ( HasCinematicFlag( player, CE_FLAG_INTRO ) || HasCinematicFlag( player, CE_FLAG_CLASSIC_MP_SPAWNING ) || HasCinematicFlag( player, CE_FLAG_WAVE_SPAWNING ) ) )
thread GiveLoadoutWhenIntroOver( player )
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
index 77275b9f..e8bc0966 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
@@ -121,6 +121,7 @@ void function GamemodeFD_Init()
Riff_ForceBoostAvailability( eBoostAvailability.Disabled )
PlayerEarnMeter_SetEnabled( false )
SetShouldUsePickLoadoutScreen( true )
+ SetAllowLoadoutChangeFunc( FD_ShouldAllowChangeLoadout )
SetGetDifficultyFunc( FD_GetDifficultyLevel )
TeamTitanSelectMenu_Init() // show the titan select menu in this mode
@@ -167,6 +168,12 @@ void function GamemodeFD_Init()
SetUsedCoreCallback( FD_UsedCoreCallback )
}
+// this might need updating when we do dropship things
+bool function FD_ShouldAllowChangeLoadout( entity player )
+{
+ return GetGlobalNetTime( "FD_nextWaveStartTime" ) > Time()
+}
+
void function FD_BoostPurchaseCallback( entity player, BoostStoreData data )
{
file.playerAwardStats[player]["moneySpent"] += float( data.cost )