From c543c9eaa27a0a486a14d84cefdb29fcf4d067e0 Mon Sep 17 00:00:00 2001 From: MysterD Date: Fri, 25 Mar 2022 23:18:48 -0700 Subject: [PATCH] hide-and-seek: disable friendly fire --- mods/hide-and-seek.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mods/hide-and-seek.lua b/mods/hide-and-seek.lua index aa5120fd..93022c97 100644 --- a/mods/hide-and-seek.lua +++ b/mods/hide-and-seek.lua @@ -418,6 +418,15 @@ function on_pause_exit(exitToCastle) end end +function allow_pvp_attack(m1, m2) + local s1 = gPlayerSyncTable[m1.playerIndex] + local s2 = gPlayerSyncTable[m2.playerIndex] + if s1.seeking == s2.seeking then + return false + end + return true +end + ----------------------- -- network callbacks -- ----------------------- @@ -470,6 +479,7 @@ hook_event(HOOK_ON_PVP_ATTACK, on_pvp_attack) hook_event(HOOK_ON_PLAYER_CONNECTED, on_player_connected) hook_event(HOOK_ON_HUD_RENDER, on_hud_render) hook_event(HOOK_ON_PAUSE_EXIT, on_pause_exit) +hook_event(HOOK_ALLOW_PVP_ATTACK, allow_pvp_attack) hook_chat_command('hide-and-seek', "[on|off] turn hide-and-seek on or off", on_hide_and_seek_command) hook_chat_command('anti-camp', "[on|off] turn the anti-camp timer on or off", on_anti_camp_command)