diff options
author | zxcPandora <81985226+zxcPandora@users.noreply.github.com> | 2022-12-15 17:49:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-15 10:49:27 +0100 |
commit | a7353815e4b1211a2b983e7000d6c6a2f34f1738 (patch) | |
tree | 8d055b5b98348b8f340413813a0492e5e49b6e66 /Northstar.CustomServers/mod/scripts/vscripts | |
parent | 2073313713d6500c7925191420fec9d42efd0133 (diff) | |
download | NorthstarMods-a7353815e4b1211a2b983e7000d6c6a2f34f1738.tar.gz NorthstarMods-a7353815e4b1211a2b983e7000d6c6a2f34f1738.zip |
[FD]Player Data Collect (#465)
* Player Data Collect
Player Data Collect
* Compare time
Compare time
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Specification and support more callback
Specification and support more callback
* Add Battery Heal Callback
Add Battery Heal Callback
* Add Battery Heal Collect
Add Battery Heal Collect
* Add files via upload
* Update _gamemode_fd.nut
* Update mp_titanweapon_stun_laser.nut
* Improve AddSmokeHealCallback
Improve AddSmokeHealCallback
* Add Smoke Heal Collect
Add Smoke Heal Collect
* Check the battery owner
Check the battery owner
* Update mp_titanability_smoke.nut
* Delete mp_titanability_smoke.nut
* Delete mp_titanweapon_stun_laser.nut
* Adapt to new code
1.Adapt to new code:heals,timeNearHarvester,SetUsedCoreCallback
2.Add data collect:turretKills
* Update _gamemode_fd.nut
* Add score for heal teammate(test)
Add score for heal teammate
* Add Heal Score
Add Heal Score
* Update _gamemode_fd.nut
* Update _rodeo_titan.gnut
* Update _gamemode_fd.nut
* Update _gamemode_fd.nut
* Update _gamemode_fd.nut
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Update Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
* Update _gamemode_fd.nut
Co-authored-by: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com>
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut | 123 | ||||
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut | 17 |
2 files changed, 138 insertions, 2 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut index 3c6fa3a6..1e282f96 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut +++ b/Northstar.CustomServers/mod/scripts/vscripts/gamemodes/_gamemode_fd.nut @@ -40,6 +40,8 @@ struct player_struct_fd{ */ float lastRespawn float lastTitanDrop + float lastNearHarvester + bool leaveHarvester } global HarvesterStruct& fd_harvester @@ -157,6 +159,12 @@ void function GamemodeFD_Init() //earn meter ScoreEvent_SetupEarnMeterValuesForMixedModes() + + //Data Collection + AddStunLaserHealCallback( FD_StunLaserHealTeammate ) + AddBatteryHealCallback( FD_BatteryHealTeammate ) + AddSmokeHealCallback( FD_SmokeHealTeammate ) + SetUsedCoreCallback( FD_UsedCoreCallback ) } void function FD_BoostPurchaseCallback( entity player, BoostStoreData data ) @@ -290,6 +298,7 @@ void function GamemodeFD_InitPlayer( entity player ) { player_struct_fd data data.diedThisRound = false + data.leaveHarvester = true file.players[player] <- data table<string, float> awardStats foreach( string statRef in GetFDStatRefs() ) @@ -339,6 +348,10 @@ void function OnTickDeath( entity victim, var damageInfo ) void function OnNpcDeath( entity victim, entity attacker, var damageInfo ) { + if( attacker.GetClassName() == "npc_turret_sentry" ) + { + file.playerAwardStats[attacker.GetBossPlayer()]["turretKills"]++ + } if( victim.IsTitan() && attacker in file.players ) file.playerAwardStats[attacker]["titanKills"]++ int victimTypeID = FD_GetAITypeID_ByString( victim.GetTargetName() ) @@ -876,6 +889,52 @@ void function SetWaveStateReady() SetGlobalNetInt( "FD_waveState", WAVE_STATE_IN_PROGRESS ) } +void function FD_StunLaserHealTeammate( entity player, entity target, int shieldRestoreAmount ) +{ + if( IsValid( player ) && player in file.players ){ + file.playerAwardStats[player]["heals"] += shieldRestoreAmount + player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, shieldRestoreAmount / 100 ) + file.players[ player ].scoreThisRound += shieldRestoreAmount / 100 + } +} + +void function FD_SmokeHealTeammate( entity player, entity target, int shieldRestoreAmount ) +{ + if( IsValid( player ) && player in file.players ){ + file.playerAwardStats[player]["heals"] += shieldRestoreAmount + player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, shieldRestoreAmount / 100 ) + file.players[ player ].scoreThisRound += shieldRestoreAmount / 100 + } +} + +void function FD_BatteryHealTeammate( entity battery, entity titan, int shieldRestoreAmount, int healthRestoreAmount ) +{ + entity BatteryParent = battery.GetParent() + entity TargetTitan + int currentHeal + int currentHealScore + + if( titan.IsPlayer() ) + TargetTitan = titan + else if( titan.GetBossPlayer() != null ) + TargetTitan = titan.GetBossPlayer() + else + return + + if( BatteryParent == TargetTitan ) + return + + if( IsValid( BatteryParent ) && BatteryParent in file.players ){ + currentHeal = shieldRestoreAmount + healthRestoreAmount + currentHealScore = currentHeal / 100 + file.playerAwardStats[BatteryParent]["heals"] += currentHeal + player.AddToPlayerGameStat( PGS_DEFENSE_SCORE, currentHealScore ) + file.players[ BatteryParent ].scoreThisRound += currentHealScore + } +} + +void function gameWonMedals() + void function FD_SetupEpilogue() { AddCallback_GameStateEnter( eGameState.Epilogue, FD_Epilogue ) @@ -1310,6 +1369,68 @@ void function FD_createHarvester() fd_harvester.harvester.Minimap_SetZOrder( MINIMAP_Z_OBJECT ) fd_harvester.harvester.Minimap_SetCustomState( eMinimapObject_prop_script.FD_HARVESTER ) AddEntityCallback_OnDamaged( fd_harvester.harvester, OnHarvesterDamaged ) + thread CreateHarvesterHintTrigger( fd_harvester.harvester ) +} + +void function CreateHarvesterHintTrigger( entity harvester ) +{ + entity trig = CreateEntity( "trigger_cylinder" ) + trig.SetRadius( 1000 ) //Test setting + trig.SetAboveHeight( 2500 ) //Test setting + trig.SetBelowHeight( 2500 ) //Test setting + trig.SetOrigin( harvester.GetOrigin() ) + trig.kv.triggerFilterNpc = "none" + trig.kv.triggerFilterPlayer = "all" + + SetTeam( trig, harvester.GetTeam() ) + DispatchSpawn( trig ) + trig.SetEnterCallback( OnEnterNearHarvesterTrigger ) + trig.SetLeaveCallback( OnLeaveNearHarvesterTrigger ) + + harvester.EndSignal( "OnDestroy" ) + trig.EndSignal( "OnDestroy" ) + + OnThreadEnd( + function() : ( trig ) + { + if ( IsValid( trig ) ) + trig.Destroy() + } + ) + + WaitForever() +} + +void function OnEnterNearHarvesterTrigger( entity trig, entity activator ) +{ + if( !( activator in file.players ) ) + return + + if( GetGlobalNetInt( "FD_waveState" ) != WAVE_STATE_IN_PROGRESS ) + return + + if ( activator != null && activator.IsPlayer() && activator.GetTeam() == trig.GetTeam() && file.players[activator].leaveHarvester == true ) + { + file.players[activator].lastNearHarvester = Time() + file.players[activator].leaveHarvester = false + } +} + +void function OnLeaveNearHarvesterTrigger( entity trig, entity activator ) +{ + if( !( activator in file.players ) ) + return + + if( GetGlobalNetInt( "FD_waveState" ) != WAVE_STATE_IN_PROGRESS ) + return + + float CurrentTime = Time() - file.players[activator].lastNearHarvester + + if ( activator != null && activator.IsPlayer() && activator.GetTeam() == trig.GetTeam() && file.players[activator].leaveHarvester == false ) + { + file.playerAwardStats[activator]["timeNearHarvester"] += CurrentTime + file.players[activator].leaveHarvester = true + } } bool function isFinalWave() @@ -1661,4 +1782,4 @@ string function FD_DropshipGetAnimation() return "dropship_coop_respawn_digsite" } return "dropship_coop_respawn" -}
\ No newline at end of file +} diff --git a/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut b/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut index 9f05a0cd..0984eaa8 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/rodeo/_rodeo_titan.gnut @@ -27,6 +27,7 @@ global function Rodeo_PilotPicksUpBattery_Silent global function AddOnRodeoStartedCallback global function AddOnRodeoEndedCallback +global function AddBatteryHealCallback global function PilotBattery_SetMaxCount global function ThrowRiderOff @@ -89,6 +90,7 @@ struct { array<void functionref(entity,entity)> onRodeoEndedCallbacks array<void functionref(entity,entity)> onRodeoStartedCallbacks + array<void functionref(entity,entity,int,int)> batteryHealCallbacks table<entity, AntiRodeoPlayerData> antiRodeoPlayerData @@ -532,6 +534,12 @@ void function AddOnRodeoEndedCallback( void functionref(entity,entity) callbackF file.onRodeoEndedCallbacks.append( callbackFunc ) } +void function AddBatteryHealCallback( void functionref(entity,entity,int,int) callbackFunc ) +{ + Assert (!( file.batteryHealCallbacks.contains( callbackFunc ) )) + file.batteryHealCallbacks.append( callbackFunc ) +} + function PlayerBeginsTitanRodeo( entity player, RodeoPackageStruct rodeoPackage, entity rodeoTitan ) { entity soul = rodeoTitan.GetTitanSoul() @@ -1766,6 +1774,8 @@ void function Rodeo_ApplyBatteryToTitan( entity battery, entity titan ) int addHealth = int( healingAmount * frac ) int totalHealth = minint( titan.GetMaxHealth(), titan.GetHealth() + addHealth ) + if( titan.GetHealth() + addHealth > titan.GetMaxHealth() ) + addHealth = titan.GetMaxHealth() - titan.GetHealth() if ( soul.IsDoomed() && batteryIsAmped ) { UndoomTitan( titan, 1 ) @@ -1776,6 +1786,11 @@ void function Rodeo_ApplyBatteryToTitan( entity battery, entity titan ) titan.SetHealth( totalHealth ) soul.SetShieldHealth( soul.GetShieldHealthMax() ) } + + foreach ( callbackFunc in file.batteryHealCallbacks ) + { + callbackFunc( battery, titan, shieldDifference, addHealth ) + } } if ( battery != null ) @@ -2453,4 +2468,4 @@ bool function ClientCommand_TryNukeGrenade( entity player, array<string> args ) return true } -#endif
\ No newline at end of file +#endif |