From 783e437c5e2be00e84a5b4298377bc6f2f6bf325 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Thu, 7 May 2015 09:49:53 +0200 Subject: [PATCH] Enforces antagHUD restrictions. antagHUD checks were missing in a few places. Can no longer join as drone, ERT member, or pAI if you have enabled antagHUD. --- code/game/response_team.dm | 4 +++- code/modules/client/client procs.dm | 11 +++++++++++ code/modules/mob/dead/observer/observer.dm | 11 ++++++++--- code/modules/mob/living/carbon/brain/posibrain.dm | 2 +- code/modules/mob/living/silicon/pai/recruit.dm | 4 ++-- .../living/silicon/robot/drone/drone_manufacturer.dm | 3 +++ code/modules/mob/new_player/new_player.dm | 3 +++ 7 files changed, 31 insertions(+), 7 deletions(-) diff --git a/code/game/response_team.dm b/code/game/response_team.dm index dafd819016..416edf78ca 100644 --- a/code/game/response_team.dm +++ b/code/game/response_team.dm @@ -38,10 +38,12 @@ var/can_call_ert log_admin("[key_name(usr)] used Dispatch Response Team.") trigger_armed_response_team(1) - client/verb/JoinResponseTeam() set category = "IC" + if(!MayRespawn(1)) + return + if(istype(usr,/mob/dead/observer) || istype(usr,/mob/new_player)) if(!send_emergency_team) usr << "No emergency response team is currently being sent." diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index a8efe68418..d68356792c 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -302,3 +302,14 @@ 'html/images/ntlogo.png', 'html/images/talisman.png' ) + + +mob/proc/MayRespawn() + return 0 + +client/proc/MayRespawn() + if(mob) + return mob.MayRespawn() + + // Something went wrong, client is usually kicked or transfered to a new mob at this point + return 0 diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 058f5d6044..5f1c1cb7b7 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -427,9 +427,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp src << "Spawning as a mouse is currently disabled." return - var/mob/dead/observer/M = usr - if(config.antag_hud_restricted && M.has_enabled_antagHUD == 1) - src << "antagHUD restrictions prevent you from spawning in as a mouse." + if(!MayRespawn(1)) return var/timedifference = world.time - client.time_died_as_mouse @@ -620,3 +618,10 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp /mob/dead/observer/canface() return 1 + +mob/dead/observer/MayRespawn(var/feedback = 0) + if(config.antag_hud_restricted && has_enabled_antagHUD == 1) + if(feedback) + src << "antagHUD restrictions prevent you from respawning." + return 0 + return 1 diff --git a/code/modules/mob/living/carbon/brain/posibrain.dm b/code/modules/mob/living/carbon/brain/posibrain.dm index 08f2e34243..4f4543b3b9 100644 --- a/code/modules/mob/living/carbon/brain/posibrain.dm +++ b/code/modules/mob/living/carbon/brain/posibrain.dm @@ -26,7 +26,7 @@ /obj/item/device/mmi/digital/posibrain/proc/request_player() for(var/mob/dead/observer/O in player_list) - if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted) + if(!O.MayRespawn()) continue if(jobban_isbanned(O, "AI") && jobban_isbanned(O, "Cyborg")) continue diff --git a/code/modules/mob/living/silicon/pai/recruit.dm b/code/modules/mob/living/silicon/pai/recruit.dm index 650b20cf7c..8a7328ed35 100644 --- a/code/modules/mob/living/silicon/pai/recruit.dm +++ b/code/modules/mob/living/silicon/pai/recruit.dm @@ -235,7 +235,7 @@ var/datum/paiController/paiController // Global handler for pAI candidates if(c.ready) var/found = 0 for(var/mob/dead/observer/o in player_list) - if(o.key == c.key) + if(o.key == c.key && o.MayRespawn()) found = 1 if(found) available.Add(c) @@ -348,7 +348,7 @@ var/datum/paiController/paiController // Global handler for pAI candidates /datum/paiController/proc/requestRecruits(var/mob/user) inquirer = user for(var/mob/dead/observer/O in player_list) - if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted) + if(!O.MayRespawn()) continue if(jobban_isbanned(O, "pAI")) continue diff --git a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm index d8009e6161..44714ffd44 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_manufacturer.dm @@ -102,6 +102,9 @@ if(jobban_isbanned(src,"Cyborg")) usr << "\red You are banned from playing synthetics and cannot spawn as a drone." return + + if(!MayRespawn(1)) + return var/deathtime = world.time - src.timeofdeath if(istype(src,/mob/dead/observer)) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 662715ca21..4222fc9651 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -527,3 +527,6 @@ /mob/new_player/hear_radio(var/message, var/verb="says", var/datum/language/language=null, var/part_a, var/part_b, var/mob/speaker = null, var/hard_to_hear = 0) return + +mob/new_player/MayRespawn() + return 1