The Ghost AntagHUD Feature.

Created configurations for Server Admins to be able to toggle it within default config.

Modified my previous AdminVerb that allows respawns to bypass the limitations of the restrictions while also letting the admins know if the ghost has used AntagHUD

Created restriction checks for various forms of joining the round and if administrators/hosts have restricted AntagHUD users from joining the round they will not be able to.

To Do:
Create Adminverb for toggling restrictions to also be able to toggle everyones ability to use antagHUD for a round.
Create a method for "Job Banning" users from using antagHUD.
This commit is contained in:
Ccomp5950
2013-11-17 08:24:23 -06:00
committed by Mloc-Argent
parent 1583eb437f
commit dbf24606bd
7 changed files with 114 additions and 8 deletions

View File

@@ -43,7 +43,8 @@
var/Tickcomp = 0 var/Tickcomp = 0
var/socket_talk = 0 // use socket_talk to communicate with other processes var/socket_talk = 0 // use socket_talk to communicate with other processes
var/list/resource_urls = null var/list/resource_urls = null
var/antag_hud_allowed = 0 // Ghosts can turn on Antagovision to see a HUD of who is the bad guys this round.
var/antag_hud_restricted = 0 // Ghosts that turn on Antagovision cannot rejoin the round.
var/list/mode_names = list() var/list/mode_names = list()
var/list/modes = list() // allowed modes var/list/modes = list() // allowed modes
var/list/votable_modes = list() // votable modes var/list/votable_modes = list() // votable modes
@@ -385,6 +386,11 @@
if("ticklag") if("ticklag")
Ticklag = text2num(value) Ticklag = text2num(value)
if("allow_antag_hud")
config.antag_hud_allowed = 1
if("antag_hud_restricted")
config.antag_hud_restricted = 1
if("socket_talk") if("socket_talk")
socket_talk = text2num(value) socket_talk = text2num(value)

View File

@@ -229,7 +229,7 @@ Ccomp's first proc.
/client/proc/allow_character_respawn() /client/proc/allow_character_respawn()
set category = "Special Verbs" set category = "Special Verbs"
set name = "Allow player to respawn" set name = "Allow player to respawn"
set desc = "Let's the player bypass the 30 minute wait to respawn." set desc = "Let's the player bypass the 30 minute wait to respawn or allow them to re-enter their corpse."
if(!holder) if(!holder)
src << "Only administrators may use this command." src << "Only administrators may use this command."
var/any = 0 var/any = 0
@@ -252,14 +252,20 @@ Ccomp's first proc.
src << "Hrm, appears you didn't select a ghost" // Sanity check, if no ghosts in the list we don't want to edit a null variable and cause a runtime error. src << "Hrm, appears you didn't select a ghost" // Sanity check, if no ghosts in the list we don't want to edit a null variable and cause a runtime error.
return return
var/mob/M = ghosts[target] var/mob/dead/observer/G = ghosts[target]
M.timeofdeath=-19999 /* time of death is checked in /mob/verb/abandon_mob() which is the Respawn verb. if(G.has_enabled_antagHUD && config.antag_hud_restricted)
var/response = alert(src, "Are you sure you wish to allow this individual to play?","Ghost has used AntagHUD","Yes","No")
if(response == "No") return
G.timeofdeath=-19999 /* time of death is checked in /mob/verb/abandon_mob() which is the Respawn verb.
timeofdeath is used for bodies on autopsy but since we're messing with a ghost I'm pretty sure timeofdeath is used for bodies on autopsy but since we're messing with a ghost I'm pretty sure
there won't be an autopsy. there won't be an autopsy.
*/ */
M:show_message(text("\blue <B>You may now respawn. You should roleplay as if you learned nothing about the round during your time with the dead.</B>"), 1) G.has_enabled_antagHUD = 2
log_admin("[key_name(usr)] allowed [key_name(M)] to bypass the 30 minute respawn limit") G.can_reenter_corpse = 1
message_admins("Admin [key_name_admin(usr)] allowed [key_name_admin(M)] to bypass the 30 minute respawn limit", 1)
G:show_message(text("\blue <B>You may now respawn. You should roleplay as if you learned nothing about the round during your time with the dead.</B>"), 1)
log_admin("[key_name(usr)] allowed [key_name(G)] to bypass the 30 minute respawn limit")
message_admins("Admin [key_name_admin(usr)] allowed [key_name_admin(G)] to bypass the 30 minute respawn limit", 1)

View File

@@ -16,6 +16,8 @@
var/started_as_observer //This variable is set to 1 when you enter the game as an observer. var/started_as_observer //This variable is set to 1 when you enter the game as an observer.
//If you died in the game and are a ghsot - this will remain as null. //If you died in the game and are a ghsot - this will remain as null.
//Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot. //Note that this is not a reliable way to determine if admins started as observers, since they change mobs a lot.
var/has_enabled_antagHUD = 0
var/antagHUD = 0
universal_speak = 1 universal_speak = 1
var/atom/movable/following = null var/atom/movable/following = null
/mob/dead/observer/New(mob/body) /mob/dead/observer/New(mob/body)
@@ -70,6 +72,60 @@ Transfer_mind is there to check if mob is being deleted/not going to have a body
Works together with spawning an observer, noted above. Works together with spawning an observer, noted above.
*/ */
/mob/dead/observer/Life()
..()
if(!loc) return
if(!client) return 0
if(client.images.len)
for(var/image/hud in client.images)
if(copytext(hud.icon_state,1,4) == "hud")
client.images.Remove(hud)
if(M.antagHUD)
var/list/target_list = list()
for(var/mob/living/target in oview(M))
if( target.mind&&(target.mind.special_role||issilicon(target)) )
target_list += target
if(target_list.len)
M.assess_targets(target_list, M)
/mob/dead/proc/assess_targets(list/target_list, mob/living/carbon/U)
var/icon/tempHud = 'icons/mob/hud.dmi'
for(var/mob/living/target in target_list)
if(iscarbon(target))
switch(target.mind.special_role)
if("traitor","Syndicate")
U.client.images += image(tempHud,target,"hudsyndicate")
if("Revolutionary")
U.client.images += image(tempHud,target,"hudrevolutionary")
if("Head Revolutionary")
U.client.images += image(tempHud,target,"hudheadrevolutionary")
if("Cultist")
U.client.images += image(tempHud,target,"hudcultist")
if("Changeling")
U.client.images += image(tempHud,target,"hudchangeling")
if("Wizard","Fake Wizard")
U.client.images += image(tempHud,target,"hudwizard")
if("Hunter","Sentinel","Drone","Queen")
U.client.images += image(tempHud,target,"hudalien")
if("Death Commando")
U.client.images += image(tempHud,target,"huddeathsquad")
if("Ninja")
U.client.images += image(tempHud,target,"hudninja")
else//If we don't know what role they have but they have one.
U.client.images += image(tempHud,target,"hudunknown1")
else//If the silicon mob has no law datum, no inherent laws, or a law zero, add them to the hud.
var/mob/living/silicon/silicon_target = target
if(!silicon_target.laws||(silicon_target.laws&&(silicon_target.laws.zeroth||!silicon_target.laws.inherent.len))||silicon_target.mind.special_role=="traitor")
if(isrobot(silicon_target))//Different icons for robutts and AI.
U.client.images += image(tempHud,silicon_target,"hudmalborg")
else
U.client.images += image(tempHud,silicon_target,"hudmalai")
return 1
/mob/proc/ghostize(var/can_reenter_corpse = 1) /mob/proc/ghostize(var/can_reenter_corpse = 1)
if(key) if(key)
var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc. var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc.
@@ -162,6 +218,29 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
mind.current.key = key mind.current.key = key
return 1 return 1
/mob/dead/observer/verb/toggle_antagHUD()
set category = "Ghost"
set name = "Toggle AntagHUD"
set desc = "Toggles AntagHUD allowing you to see who is the antagonist"
if(!config.antag_hud_allowed)
src << "\red Admins have disabled this for this round."
return
if(!client)
return
var/mob/dead/observer/M = src
if(config.antag_hud_restricted && !M.has_enabled_antagHUD)
var/response = alert(src, "If you turn this on, you will not be able to take any part in the round.","Are you sure you want to turn this feature on?","Yes","No")
if(response == "No") return
M.can_reenter_corpse = 0
if(!M.has_enabled_antagHUD)
M.has_enabled_antagHUD = 1
if(M.antagHUD)
M.antagHUD = 0
src << "\blue <B>AntagHUD Disabled</B>"
else
M.antagHUD = 1
src << "\blue <B>AntagHUD Enabled</B>"
/mob/dead/observer/proc/dead_tele() /mob/dead/observer/proc/dead_tele()
set category = "Ghost" set category = "Ghost"
set name = "Teleport" set name = "Teleport"

View File

@@ -27,6 +27,8 @@
proc/request_player() proc/request_player()
for(var/mob/dead/observer/O in player_list) for(var/mob/dead/observer/O in player_list)
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
continue
if(jobban_isbanned(O, "pAI")) if(jobban_isbanned(O, "pAI"))
continue continue
if(O.client) if(O.client)

View File

@@ -191,6 +191,8 @@ var/datum/paiController/paiController // Global handler for pAI candidates
proc/requestRecruits() proc/requestRecruits()
for(var/mob/dead/observer/O in player_list) for(var/mob/dead/observer/O in player_list)
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
continue
if(jobban_isbanned(O, "pAI")) if(jobban_isbanned(O, "pAI"))
continue continue
if(asked.Find(O.key)) if(asked.Find(O.key))

View File

@@ -348,6 +348,10 @@ var/list/slot_equipment_priority = list( \
return return
else else
var/deathtime = world.time - src.timeofdeath var/deathtime = world.time - src.timeofdeath
var/mob/dead/observer/G = src
if(G.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
usr << "\blue <B>Upon using the antagHUD you forfeighted the ability to join the round.</B>"
return
var/deathtimeminutes = round(deathtime / 600) var/deathtimeminutes = round(deathtime / 600)
var/pluralcheck = "minute" var/pluralcheck = "minute"
if(deathtimeminutes == 0) if(deathtimeminutes == 0)
@@ -358,6 +362,7 @@ var/list/slot_equipment_priority = list( \
pluralcheck = " [deathtimeminutes] minutes and" pluralcheck = " [deathtimeminutes] minutes and"
var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10,1) var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10,1)
usr << "You have been dead for[pluralcheck] [deathtimeseconds] seconds." usr << "You have been dead for[pluralcheck] [deathtimeseconds] seconds."
if (deathtime < 18000) if (deathtime < 18000)
usr << "You must wait 30 minutes to respawn!" usr << "You must wait 30 minutes to respawn!"
return return

View File

@@ -121,6 +121,12 @@ VOTE_AUTOTRANSFER_INTERVAL 36000
## players' votes default to "No vote" (otherwise, default to "No change") ## players' votes default to "No vote" (otherwise, default to "No change")
DEFAULT_NO_VOTE DEFAULT_NO_VOTE
## Allow ghosts to see antagonist through AntagHUD
ALLOW_ANTAG_HUD
## If ghosts use antagHUD they are no longer allowed to join the round.
ANTAG_HUD_RESTRICTED
## allow AI job ## allow AI job
ALLOW_AI ALLOW_AI