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 | |
parent | 2ca90c09e1b4f3718a6a8add8e4efa75258015ba (diff) | |
download | NorthstarMods-bca681c6e7b2b281a234d1ee9cbd671f97e45cb6.tar.gz NorthstarMods-bca681c6e7b2b281a234d1ee9cbd671f97e45cb6.zip |
Add respawn protection match setting (#167)
6 files changed, 51 insertions, 1 deletions
diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 4f2e7a77..ae84e7c4 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt @@ -55,6 +55,7 @@ Press Yes if you agree to this. This choice can be changed in the mods menu at a "roundscorelimit" "Score Limit (round-based)" "timelimit" "Time Limit" "roundtimelimit" "Time Limit (round-based)" + "respawnprotection" "Respawn Protection Time" "pilot_health_multiplier" "Health multiplier" "respawn_delay" "Respawn Delay" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt b/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt index c00e7302..a8d6b811 100644 --- a/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt +++ b/Northstar.Client/mod/resource/northstar_client_localisation_tchinese.txt @@ -52,6 +52,7 @@ "roundscorelimit" "分數限制(回合制)" "timelimit" "時間限制" "roundtimelimit" "時間限制(回合制)" + "respawnprotection" "重生保護時間" "pilot_health_multiplier" "生命值加成" "respawn_delay" "重生延遲" 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" ) |