diff options
author | zxcPandora <81985226+zxcPandora@users.noreply.github.com> | 2022-02-15 12:14:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-15 01:14:36 -0300 |
commit | bca681c6e7b2b281a234d1ee9cbd671f97e45cb6 (patch) | |
tree | 5726d64e49464eab957a8e436eb0fd4b094db033 /Northstar.CustomServers | |
parent | 2ca90c09e1b4f3718a6a8add8e4efa75258015ba (diff) | |
download | NorthstarMods-bca681c6e7b2b281a234d1ee9cbd671f97e45cb6.tar.gz NorthstarMods-bca681c6e7b2b281a234d1ee9cbd671f97e45cb6.zip |
Add respawn protection match setting (#167)
Diffstat (limited to 'Northstar.CustomServers')
4 files changed, 49 insertions, 1 deletions
diff --git a/Northstar.CustomServers/mod.json b/Northstar.CustomServers/mod.json index 9388b16f..e7c00daa 100644 --- a/Northstar.CustomServers/mod.json +++ b/Northstar.CustomServers/mod.json @@ -104,6 +104,14 @@ { "Path": "lobby/sh_private_lobby_modes_init.gnut", "RunOn": "( SERVER || CLIENT ) && MP" + }, + + { + "Path": "_respawn_protection.gnut", + "RunOn": "SERVER && MP", + "ServerCallback": { + "Before": "RespawnProtection_Init" + } } ] }
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut new file mode 100644 index 00000000..2fb17767 --- /dev/null +++ b/Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut @@ -0,0 +1,39 @@ +global function RespawnProtection_Init + +void function RespawnProtection_Init(){ + AddCallback_OnPlayerRespawned( OnPlayerRespawned ) +} + +void function OnPlayerRespawned( entity player ) +{ + thread RespawnProtection(player,GetCurrentPlaylistVarFloat("respawnprotection",0.0)) +} + +void function RespawnProtection( entity player , float time ){ + OnThreadEnd( + function() : ( player ) + { + //cancel protect if player attack + if( IsDemigod( player ) ) + { + DisableDemigod( player ); + } + } + ) + + player.EndSignal( "OnDeath" ) + player.EndSignal( "OnDestroy" ) + player.EndSignal( "OnPrimaryAttack" ) + + if( IsDemigod( player ) ) + { + DisableDemigod( player ); + } + else{ + //start protect + EnableDemigod( player ) + wait time + //cancel protect + DisableDemigod( player ); + } +} diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut index 59bba002..1644afd9 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/_utility.gnut @@ -4401,4 +4401,4 @@ bool function PlayerHasTitan( entity player ) return true return false -} +}
\ No newline at end of file diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut index 68d6a5d7..719ea336 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/sh_private_lobby_modes_init.gnut @@ -10,6 +10,7 @@ void function PrivateMatchModesInit() AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_MATCH", "roundscorelimit", "0" ) //, "Score Limit (round-based modes)" ) AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_MATCH", "timelimit", "12" ) //, "Time Limit" ) AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_MATCH", "roundtimelimit", "0" ) //, "Time Limit (round-based modes)" ) + AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_MATCH", "respawnprotection", "0.0" ) //, "Player Respawn Protection Time" ) AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_PILOT", "pilot_health_multiplier", "1.0" ) AddPrivateMatchModeSettingArbitrary( "#MODE_SETTING_CATEGORY_PILOT", "respawn_delay", "0.0" ) |