mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
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:
@@ -43,7 +43,8 @@
|
||||
var/Tickcomp = 0
|
||||
var/socket_talk = 0 // use socket_talk to communicate with other processes
|
||||
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/modes = list() // allowed modes
|
||||
var/list/votable_modes = list() // votable modes
|
||||
@@ -385,6 +386,11 @@
|
||||
if("ticklag")
|
||||
Ticklag = text2num(value)
|
||||
|
||||
if("allow_antag_hud")
|
||||
config.antag_hud_allowed = 1
|
||||
if("antag_hud_restricted")
|
||||
config.antag_hud_restricted = 1
|
||||
|
||||
if("socket_talk")
|
||||
socket_talk = text2num(value)
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ Ccomp's first proc.
|
||||
/client/proc/allow_character_respawn()
|
||||
set category = "Special Verbs"
|
||||
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)
|
||||
src << "Only administrators may use this command."
|
||||
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.
|
||||
return
|
||||
|
||||
var/mob/M = ghosts[target]
|
||||
M.timeofdeath=-19999 /* time of death is checked in /mob/verb/abandon_mob() which is the Respawn verb.
|
||||
var/mob/dead/observer/G = ghosts[target]
|
||||
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
|
||||
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)
|
||||
log_admin("[key_name(usr)] allowed [key_name(M)] to bypass the 30 minute respawn limit")
|
||||
message_admins("Admin [key_name_admin(usr)] allowed [key_name_admin(M)] to bypass the 30 minute respawn limit", 1)
|
||||
G.has_enabled_antagHUD = 2
|
||||
G.can_reenter_corpse = 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)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
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.
|
||||
//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
|
||||
var/atom/movable/following = null
|
||||
/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.
|
||||
*/
|
||||
|
||||
/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)
|
||||
if(key)
|
||||
var/mob/dead/observer/ghost = new(src) //Transfer safety to observer spawning proc.
|
||||
@@ -153,7 +209,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
if(mind.current.key && copytext(mind.current.key,1,2)!="@") //makes sure we don't accidentally kick any clients
|
||||
usr << "<span class='warning'>Another consciousness is in your body...It is resisting you.</span>"
|
||||
return
|
||||
if(mind.current.ajourn && mind.current.stat != DEAD) //check if the corpse is astral-journeying (it's client ghosted using a cultist rune).
|
||||
if(mind.current.ajourn && mind.current.stat != DEAD) //check if the corpse is astral-journeying (it's client ghosted using a cultist rune).
|
||||
var/obj/effect/rune/R = locate() in mind.current.loc //whilst corpse is alive, we can only reenter the body if it's on the rune
|
||||
if(!(R && R.word1 == cultwords["hell"] && R.word2 == cultwords["travel"] && R.word3 == cultwords["self"])) //astral journeying rune
|
||||
usr << "<span class='warning'>The astral cord that ties your body and your spirit has been severed. You are likely to wander the realm beyond until your body is finally dead and thus reunited with you.</span>"
|
||||
@@ -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
|
||||
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()
|
||||
set category = "Ghost"
|
||||
set name = "Teleport"
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
proc/request_player()
|
||||
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"))
|
||||
continue
|
||||
if(O.client)
|
||||
|
||||
@@ -191,6 +191,8 @@ var/datum/paiController/paiController // Global handler for pAI candidates
|
||||
|
||||
proc/requestRecruits()
|
||||
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"))
|
||||
continue
|
||||
if(asked.Find(O.key))
|
||||
|
||||
@@ -348,6 +348,10 @@ var/list/slot_equipment_priority = list( \
|
||||
return
|
||||
else
|
||||
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/pluralcheck = "minute"
|
||||
if(deathtimeminutes == 0)
|
||||
@@ -358,6 +362,7 @@ var/list/slot_equipment_priority = list( \
|
||||
pluralcheck = " [deathtimeminutes] minutes and"
|
||||
var/deathtimeseconds = round((deathtime - deathtimeminutes * 600) / 10,1)
|
||||
usr << "You have been dead for[pluralcheck] [deathtimeseconds] seconds."
|
||||
|
||||
if (deathtime < 18000)
|
||||
usr << "You must wait 30 minutes to respawn!"
|
||||
return
|
||||
|
||||
@@ -121,6 +121,12 @@ VOTE_AUTOTRANSFER_INTERVAL 36000
|
||||
## players' votes default to "No vote" (otherwise, default to "No change")
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user