From 8c26a0b08d8327d6db14718754ff1b44e476acd2 Mon Sep 17 00:00:00 2001 From: Maya Date: Wed, 16 Feb 2022 22:13:33 +0100 Subject: Fix Amped Hardpoint on Homestead (#174) * Adds Missing Entity Data to Homestead * Fix Homestead in Script * Encapsulated getting Hardpointgroup in function * fixing respawning on amped hardpoint --- .../scripts/vscripts/gamemodes/_gamemode_cp.nut | 57 ++++++++++++++-------- .../vscripts/gamemodes/_gamemode_speedball.nut | 10 +++- .../scripts/vscripts/gamemodes/_hardpoints.gnut | 19 ++++++-- 3 files changed, 61 insertions(+), 25 deletions(-) diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut index db1b7edd5..dddad8215 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_cp.nut @@ -15,6 +15,8 @@ struct HardpointStruct array imcCappers array militiaCappers + + } struct CP_PlayerStruct @@ -146,7 +148,7 @@ void function RateSpawnpoints_CP( int checkClass, array spawnpoints, int entity friendlyHardpoint // determine our furthest out hardpoint foreach ( entity hardpoint in HARDPOINTS ) { - if ( hardpoint.GetTeam() == player.GetTeam() && GetGlobalNetFloat( "objective" + hardpoint.kv.hardpointGroup + "Progress" ) >= 0.95 ) + if ( hardpoint.GetTeam() == player.GetTeam() && GetGlobalNetFloat( "objective" + GetHardpointGroup(hardpoint) + "Progress" ) >= 0.95 ) { if ( IsValid( friendlyHardpoint ) ) { @@ -182,10 +184,14 @@ void function SpawnHardpoints() // spawnpoints are CHardPoint entities // init the hardpoint ent int hardpointID = 0 - if ( spawnpoint.kv.hardpointGroup == "B" ) - hardpointID = 1 - else if ( spawnpoint.kv.hardpointGroup == "C" ) - hardpointID = 2 + string group = GetHardpointGroup(spawnpoint) + if ( group == "B" ) + hardpointID = 1 + else if ( group == "C" ) + hardpointID = 2 + + + spawnpoint.SetHardpointID( hardpointID ) SpawnHardpointMinimapIcon( spawnpoint ) @@ -193,6 +199,8 @@ void function SpawnHardpoints() HardpointStruct hardpointStruct hardpointStruct.hardpoint = spawnpoint hardpointStruct.prop = CreatePropDynamic( spawnpoint.GetModelName(), spawnpoint.GetOrigin(), spawnpoint.GetAngles(), 6 ) + + entity trigger = GetEnt( expect string( spawnpoint.kv.triggerTarget ) ) hardpointStruct.trigger = trigger @@ -200,9 +208,9 @@ void function SpawnHardpoints() file.hardpoints.append( hardpointStruct ) HARDPOINTS.append( spawnpoint ) // for vo script spawnpoint.s.trigger <- trigger // also for vo script - - SetGlobalNetEnt( "objective" + spawnpoint.kv.hardpointGroup + "Ent", spawnpoint ) - + + SetGlobalNetEnt( "objective" + group + "Ent", spawnpoint ) + // set up trigger functions trigger.SetEnterCallback( OnHardpointEntered ) trigger.SetLeaveCallback( OnHardpointLeft ) @@ -225,33 +233,33 @@ void function SpawnHardpointMinimapIcon( entity spawnpoint ) // functions for handling hardpoint netvars void function SetHardpointState( HardpointStruct hardpoint, int state ) { - SetGlobalNetInt( "objective" + hardpoint.hardpoint.kv.hardpointGroup + "State", state ) + SetGlobalNetInt( "objective" + GetHardpointGroup(hardpoint.hardpoint) + "State", state ) hardpoint.hardpoint.SetHardpointState( state ) } int function GetHardpointState( HardpointStruct hardpoint ) { - return GetGlobalNetInt( "objective" + hardpoint.hardpoint.kv.hardpointGroup + "State" ) + return GetGlobalNetInt( "objective" + GetHardpointGroup(hardpoint.hardpoint) + "State" ) } void function SetHardpointCappingTeam( HardpointStruct hardpoint, int team ) { - SetGlobalNetInt( "objective" + hardpoint.hardpoint.kv.hardpointGroup + "CappingTeam", team ) + SetGlobalNetInt( "objective" + GetHardpointGroup(hardpoint.hardpoint) + "CappingTeam", team ) } int function GetHardpointCappingTeam( HardpointStruct hardpoint ) { - return GetGlobalNetInt( "objective" + hardpoint.hardpoint.kv.hardpointGroup + "CappingTeam" ) + return GetGlobalNetInt( "objective" + GetHardpointGroup(hardpoint.hardpoint) + "CappingTeam" ) } void function SetHardpointCaptureProgress( HardpointStruct hardpoint, float progress ) { - SetGlobalNetFloat( "objective" + hardpoint.hardpoint.kv.hardpointGroup + "Progress", progress ) + SetGlobalNetFloat( "objective" + GetHardpointGroup(hardpoint.hardpoint) + "Progress", progress ) } float function GetHardpointCaptureProgress( HardpointStruct hardpoint ) { - return GetGlobalNetFloat( "objective" + hardpoint.hardpoint.kv.hardpointGroup + "Progress" ) + return GetGlobalNetFloat( "objective" + GetHardpointGroup(hardpoint.hardpoint) + "Progress" ) } @@ -543,8 +551,8 @@ void function HardpointThink( HardpointStruct hardpoint ) { SetHardpointState( hardpoint, CAPTURE_POINT_STATE_AMPED ) // can't use the dialogue functions here because for some reason GamemodeCP_VO_Amped isn't global? - PlayFactionDialogueToTeam( "amphp_youAmped" + hardpointEnt.kv.hardpointGroup, cappingTeam ) - PlayFactionDialogueToTeam( "amphp_enemyAmped" + hardpointEnt.kv.hardpointGroup, GetOtherTeam( cappingTeam ) ) + PlayFactionDialogueToTeam( "amphp_youAmped" + GetHardpointGroup(hardpoint.hardpoint), cappingTeam ) + PlayFactionDialogueToTeam( "amphp_enemyAmped" + GetHardpointGroup(hardpoint.hardpoint), GetOtherTeam( cappingTeam ) ) if(!hasBeenAmped){ hasBeenAmped=true @@ -671,12 +679,23 @@ string function CaptureStateToString( int state ) void function DEV_PrintHardpointsInfo() { foreach (entity hardpoint in HARDPOINTS) - { + { + printt( - "Hardpoint:", hardpoint.kv.hardpointGroup, + "Hardpoint:", GetHardpointGroup(hardpoint), "|Team:", Dev_TeamIDToString(hardpoint.GetTeam()), "|State:", CaptureStateToString(hardpoint.GetHardpointState()), - "|Progress:", GetGlobalNetFloat("objective" + hardpoint.kv.hardpointGroup + "Progress") + "|Progress:", GetGlobalNetFloat("objective" + GetHardpointGroup(hardpoint) + "Progress") ) + + } } + +string function GetHardpointGroup(entity hardpoint) //Hardpoint Entity B on Homestead is missing the Hardpoint Group KeyValue +{ + if((GetMapName()=="mp_homestead")&&(!hardpoint.HasKey("hardpointGroup"))) + return "B" + + return string(hardpoint.kv.hardpointGroup) +} \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut index 9446a8c24..cb277b004 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_speedball.nut @@ -129,7 +129,7 @@ void function CreateFlagIfNoFlagSpawnpoint() foreach ( entity hardpoint in GetEntArrayByClass_Expensive( "info_hardpoint" ) ) { - if ( hardpoint.kv.hardpointGroup == "B" ) + if ( GetHardpointGroup(hardpoint) == "B" ) { CreateFlag( hardpoint ) return @@ -160,4 +160,12 @@ void function GamemodeSpeedball_OnWinnerDetermined() { if(IsValid(file.flagCarrier)) file.flagCarrier.AddToPlayerGameStat( PGS_ASSAULT_SCORE, 1 ) +} + +string function GetHardpointGroup(entity hardpoint) //Hardpoint Entity B on Homestead is missing the Hardpoint Group KeyValue +{ + if((GetMapName()=="mp_homestead")&&(!hardpoint.HasKey("hardpointGroup"))) + return "B" + + return string(hardpoint.kv.hardpointGroup) } \ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_hardpoints.gnut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_hardpoints.gnut index 8331a81a4..260168d08 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_hardpoints.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_hardpoints.gnut @@ -15,13 +15,13 @@ void function Hardpoints_Init() } float function CapturePoint_GetStartProgress( entity hardpoint ) -{ - return GetGlobalNetFloat( "objective" + hardpoint.kv.hardpointGroup + "Progress" ) +{ + return GetGlobalNetFloat( "objective" + GetHardpointGroup(hardpoint) + "Progress" ) } int function CapturePoint_GetCappingTeam( entity hardpoint ) -{ - return GetGlobalNetInt( "objective" + hardpoint.kv.hardpointGroup + "CappingTeam" ) +{ + return GetGlobalNetInt( "objective" + GetHardpointGroup(hardpoint) + "CappingTeam" ) } int function CapturePoint_GetOwningTeam( entity hardpoint ) @@ -30,6 +30,15 @@ int function CapturePoint_GetOwningTeam( entity hardpoint ) } float function CapturePoint_GetGoalProgress( entity hardpoint ) +{ + + return GetGlobalNetFloat( "objective" + GetHardpointGroup(hardpoint) + "Progress" ) +} + +string function GetHardpointGroup(entity hardpoint) //Hardpoint Entity B on Homestead is missing the Hardpoint Group KeyValue { - return GetGlobalNetFloat( "objective" + hardpoint.kv.hardpointGroup + "Progress" ) + if((GetMapName()=="mp_homestead")&&(!hardpoint.HasKey("hardpointGroup"))) + return "B" + + return string(hardpoint.kv.hardpointGroup) } \ No newline at end of file -- cgit v1.2.3