Hud refactor

This commit is contained in:
Aurorablade
2015-12-10 01:01:54 -05:00
parent a02d49d177
commit c590958f2d
58 changed files with 1002 additions and 692 deletions
+84
View File
@@ -0,0 +1,84 @@
/* HUD DATUMS */
///GLOBAL HUD LIST
var/datum/atom_hud/huds = list(
DATA_HUD_SECURITY_BASIC = new/datum/atom_hud/data/human/security/basic(),
DATA_HUD_SECURITY_ADVANCED = new/datum/atom_hud/data/human/security/advanced(),
DATA_HUD_MEDICAL_BASIC = new/datum/atom_hud/data/human/medical/basic(),
DATA_HUD_MEDICAL_ADVANCED = new/datum/atom_hud/data/human/medical/advanced(),
DATA_HUD_DIAGNOSTIC = new/datum/atom_hud/data/diagnostic(),
ANTAG_HUD_CULT = new/datum/atom_hud/antag(),
ANTAG_HUD_REV = new/datum/atom_hud/antag(),
ANTAG_HUD_OPS = new/datum/atom_hud/antag(),
ANTAG_HUD_WIZ = new/datum/atom_hud/antag(),
ANTAG_HUD_SHADOW = new/datum/atom_hud/antag(),
DATA_HUD_NATIONS = new/datum/atom_hud/data/human/nations()
)
/datum/atom_hud
var/list/atom/hudatoms = list() //list of all atoms which display this hud
var/list/mob/hudusers = list() //list with all mobs who can see the hud
var/list/hud_icons = list() //these will be the indexes for the atom's hud_list
/datum/atom_hud/proc/remove_hud_from(mob/M)
if(!M)
return
//if(src in M.permanent_huds)//I will deal with you later -Fethas
// return
for(var/atom/A in hudatoms)
remove_from_single_hud(M, A)
hudusers -= M
/datum/atom_hud/proc/remove_from_hud(atom/A)
if(!A)
return
for(var/mob/M in hudusers)
remove_from_single_hud(M, A)
hudatoms -= A
/datum/atom_hud/proc/remove_from_single_hud(mob/M, atom/A) //unsafe, no sanity apart from client
if(!M || !M.client || !A)
return
for(var/i in hud_icons)
M.client.images -= A.hud_list[i]
/datum/atom_hud/proc/add_hud_to(mob/M)
if(!M)
return
hudusers |= M
for(var/atom/A in hudatoms)
add_to_single_hud(M, A)
/datum/atom_hud/proc/add_to_hud(atom/A)
if(!A)
return
hudatoms |= A
for(var/mob/M in hudusers)
add_to_single_hud(M, A)
/datum/atom_hud/proc/add_to_single_hud(mob/M, atom/A) //unsafe, no sanity apart from client
if(!M || !M.client || !A)
return
for(var/i in hud_icons)
if(A.hud_list[i])
M.client.images |= A.hud_list[i]
//MOB PROCS
/mob/proc/reload_huds()
//var/gang_huds = list()
//if(ticker.mode)
// for(var/datum/gang/G in ticker.mode.gangs)
// gang_huds += G.ganghud
for(var/datum/atom_hud/hud in huds)//|gang_huds))
if(src in hud.hudusers)
hud.add_hud_to(src)
/mob/new_player/reload_huds()
return
/mob/proc/add_click_catcher()
client.screen += client.void
/mob/new_player/add_click_catcher()
return
+6 -1
View File
@@ -58,6 +58,9 @@
var/datum/vampire/vampire //vampire holder
var/datum/nations/nation //nation holder
var/antag_hud_icon_state = null //this mind's ANTAG_HUD should have this icon_state
var/datum/atom_hud/antag/antag_hud = null //this mind's antag HUD
var/rev_cooldown = 0
// the world.time since the mob has been brigged, or -1 if not at all
@@ -79,6 +82,8 @@
if(new_character.mind) //remove any mind currently in our new body's mind variable
new_character.mind.current = null
var/datum/atom_hud/antag/hud_to_transfer = antag_hud//we need this because leave_hud() will clear this list
transfer_antag_huds(hud_to_transfer) //inherit the antag HUD
current = new_character //link ourself to our new body
new_character.mind = src //and link our new body to ourself
@@ -1054,7 +1059,7 @@
log_admin("[key_name(usr)] has thralled [current].")
else if (href_list["silicon"])
current.hud_updateflag |= (1 << SPECIALROLE_HUD)
//current.hud_updateflag |= (1 << SPECIALROLE_HUD)
switch(href_list["silicon"])
if("unmalf")
if(src in ticker.mode.malf_ai)