aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut
diff options
context:
space:
mode:
authorDBmaoha <56738369+DBmaoha@users.noreply.github.com>2023-01-07 04:42:13 +0800
committerGitHub <noreply@github.com>2023-01-06 21:42:13 +0100
commit4e83b351a8581ec04cd7ecd54588514eb6207ba6 (patch)
tree0f3924fd8f0caec830e20c183450e461f1693a1b /Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut
parentb8ad5076113c84136efa859c274bd515dbf984f8 (diff)
downloadNorthstarMods-4e83b351a8581ec04cd7ecd54588514eb6207ba6.tar.gz
NorthstarMods-4e83b351a8581ec04cd7ecd54588514eb6207ba6.zip
[GAMEMODE] Add gamemode_fw (#545)v1.12.0-rc2
* Initial commit Co-Authored-By: Ghroth-follower <45908037+Ghroth-follower@users.noreply.github.com> Co-Authored-By: zxcPandora <81985226+zxcPandora@users.noreply.github.com> * add customized scripts Co-Authored-By: Ghroth-follower <45908037+Ghroth-follower@users.noreply.github.com> Co-Authored-By: zxcPandora <81985226+zxcPandora@users.noreply.github.com> * add royal as co-worker Co-Authored-By: Maya <11448698+RoyalBlue1@users.noreply.github.com> * reset harvester.gnut * Update _gamemode_fw.nut * no need to update alertLevel right after clear * hacked natural turret receives less health * change consts name * update HACK_ForceDestroyNPCs() * update battery port's usePrompts * batteryPort useHint update * should do a check for titans * disable cloak while applying battery * add debounce for turret notifications * fix escalate * fix complex crash * late spawn camp trackers * defensive fix after havester destroyed * nerf salvo core and titan's earn meter * edit rodeo_titan in Northstar.Custom * make settings controllable by playlistvars * use tabs for indenting use tabs for indenting * Move game mode specific behaviour to callback use post damage callback * Move FW specific code out of _battery_port.gnut Also Split Damage Callbacks to onDamage and onPostDamage * Fix globalizing same function twice * Adding vars back to HarvesterStruct * use tabs for indenting use tabs for indenting Co-authored-by: Ghroth-follower <45908037+Ghroth-follower@users.noreply.github.com> Co-authored-by: zxcPandora <81985226+zxcPandora@users.noreply.github.com> Co-authored-by: Maya <11448698+RoyalBlue1@users.noreply.github.com> Co-authored-by: zxcPandora <1158500986@qq.com>
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut53
1 files changed, 52 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut b/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut
index c9d986bcc..349f9131f 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/titan/_replacement_titans.gnut
@@ -20,7 +20,7 @@ global function req
global function ReplacementTitan
global function TryAnnounceTitanfallWarningToEnemyTeam
global function GetTitanForPlayer
-
+global function TryPlayTitanfallNegativeSoundToPlayer
global function ShouldSetTitanRespawnTimer
@@ -33,6 +33,7 @@ global function SetReplacementTitanGamemodeRules
global function SetRequestTitanGamemodeRules
global function CreateTitanForPlayerAndHotdrop
+global function SetRequestTitanAllowedCallback
struct {
array<int> ETATimeThresholds = [ 120, 60, 30, 15 ]
@@ -53,6 +54,8 @@ struct {
bool functionref( entity ) ReplacementTitanGamemodeRules
bool functionref( entity, vector ) RequestTitanGamemodeRules
+ bool functionref( entity player, array< string > args ) RequestTitanAllowedCallback
+
} file
const nagInterval = 40
@@ -87,6 +90,10 @@ function ReplacementTitans_Init()
FlagInit( "LevelHasRoof" )
}
+void function SetRequestTitanAllowedCallback( bool functionref( entity player, array<string> args ) RequestTitanAllowedCallback )
+{
+ file.RequestTitanAllowedCallback = RequestTitanAllowedCallback
+}
void function ReplacementTitan_InitPlayer( entity player )
{
@@ -424,6 +431,7 @@ function TryETATitanReadyAnnouncement( entity player )
TryReplacementTitanReadyAnnouncement( player )
return
}
+
//This entire loop is probably too complicated now for what it's doing. Simplify next game!
//Loop might be pretty hard to read, a particular iteration of the loop is written in comments below
@@ -524,10 +532,39 @@ function req()
bool function ClientCommand_RequestTitan( entity player, array<string> args )
{
+ if( file.RequestTitanAllowedCallback != null && !file.RequestTitanAllowedCallback( player, args ) )
+ return true
+
ReplacementTitan( player ) //Separate function because other functions will call ReplacementTitan
return true
}
+bool function TryPlayTitanfallNegativeSoundToPlayer( entity player )
+{
+ if( !( "lastNegativeSound" in player.s ) )
+ player.s.lastNegativeSound <- 0.0 // float
+ if( player.s.lastNegativeSound + 3.0 > Time() ) // in sound cooldown
+ return false
+
+ EmitSoundOnEntityOnlyToPlayer( player, player, "titan_dryfire" )
+ player.s.lastNegativeSound = Time()
+
+ return true
+}
+
+/* // serverSideRUI can't handle localized strings
+void function CreateCustomMessageForRefusingTitanfall( entity player )
+{
+ if( !( "lastMessageSend" in player.s ) )
+ player.s.lastMessageSend <- 0.0 // float
+ if( player.s.lastMessageSend + 10 > Time() ) // in message cooldown
+ return
+
+ NSSendInfoMessageToPlayer( player, "#FW_OBJECTIVE_TITANFALL" )
+ player.s.lastMessageSend = Time()
+}
+*/
+
// This a baseline titan request function; the only things that prevent this from happening are
// common cases; wrong gamestate, already has a titan, is currently dead, etc...
bool function RequestTitan( entity player )
@@ -877,6 +914,20 @@ void function CreateTitanForPlayerAndHotdrop( entity player, Point spawnPoint, T
player.Signal( "titan_impact" )
thread TitanNPC_WaitForBubbleShield_StartAutoTitanBehavior( titan )
+ thread PlayerEarnMeter_ReplacementTitanThink( player, titan )
+}
+
+void function PlayerEarnMeter_ReplacementTitanThink( entity player, entity titan )
+{
+ player.EndSignal( "OnDestroy" )
+ OnThreadEnd(
+ function(): ( player )
+ {
+ if( IsValid( player ) )
+ PlayerEarnMeter_Reset( player )
+ }
+ )
+ titan.WaitSignal( "OnDestroy" )
}
void function CleanupTitanFallDisablingEntity( entity titanFallDisablingEntity, entity titan )