Fixes carelessness. (#577)

* Update hud.dm

* Delete hud.dm.rej

* Update alternate_appearance.dm

* Delete alternate_appearance.dm.rej

* Delete mob.dm.rej

* Update mob.dm
This commit is contained in:
Poojawa
2017-04-26 10:37:57 -05:00
committed by GitHub
parent 328ddaba1f
commit 8ec4cbbb9f
6 changed files with 95 additions and 133 deletions

View File

@@ -1,93 +1,93 @@
/* HUD DATUMS */
//GLOBAL HUD LIST
GLOBAL_LIST_INIT(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(),
ANTAG_HUD_TRAITOR = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_NINJA = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_CHANGELING = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_ABDUCTOR = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_DEVIL = new/datum/atom_hud/antag(),
ANTAG_HUD_SINTOUCHED = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_SOULLESS = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_CLOCKWORK = new/datum/atom_hud/antag(),
))
/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)
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)
/* HUD DATUMS */
//GLOBAL HUD LIST
GLOBAL_LIST_INIT(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(),
ANTAG_HUD_TRAITOR = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_NINJA = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_CHANGELING = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_ABDUCTOR = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_DEVIL = new/datum/atom_hud/antag(),
ANTAG_HUD_SINTOUCHED = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_SOULLESS = new/datum/atom_hud/antag/hidden(),
ANTAG_HUD_CLOCKWORK = new/datum/atom_hud/antag(),
))
/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)
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 FALSE
for(var/mob/M in hudusers)
remove_from_single_hud(M, A)
hudatoms -= A
for(var/mob/M in hudusers)
remove_from_single_hud(M, A)
hudatoms -= A
return TRUE
/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
/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] = TRUE
for(var/atom/A in hudatoms)
add_to_single_hud(M, A)
/datum/atom_hud/proc/add_to_hud(atom/A)
if(!A)
for(var/atom/A in hudatoms)
add_to_single_hud(M, A)
/datum/atom_hud/proc/add_to_hud(atom/A)
if(!A)
return FALSE
hudatoms |= A
for(var/mob/M in hudusers)
add_to_single_hud(M, A)
hudatoms |= A
for(var/mob/M in hudusers)
add_to_single_hud(M, A)
return TRUE
/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(SSticker.mode)
for(var/datum/gang/G in SSticker.mode.gangs)
gang_huds += G.ganghud
/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(SSticker.mode)
for(var/datum/gang/G in SSticker.mode.gangs)
gang_huds += G.ganghud
for(var/datum/atom_hud/hud in (GLOB.huds|gang_huds|GLOB.active_alternate_appearances))
if(hud.hudusers[src])
hud.add_hud_to(src)
/mob/dead/new_player/reload_huds()
return
/mob/proc/add_click_catcher()
client.screen += client.void
/mob/dead/new_player/add_click_catcher()
return
if(hud && hud.hudusers[src])
hud.add_hud_to(src)
/mob/dead/new_player/reload_huds()
return
/mob/proc/add_click_catcher()
client.screen += client.void
/mob/dead/new_player/add_click_catcher()
return

View File

@@ -1,10 +0,0 @@
diff a/code/datums/hud.dm b/code/datums/hud.dm (rejected hunks)
@@ -80,7 +80,7 @@ GLOBAL_LIST_INIT(huds, list(
gang_huds += G.ganghud
for(var/datum/atom_hud/hud in (GLOB.huds|gang_huds|GLOB.active_alternate_appearances))
- if(hud.hudusers[src])
+ if(hud && hud.hudusers[src])
hud.add_hud_to(src)
/mob/dead/new_player/reload_huds()

View File

@@ -29,13 +29,12 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
appearance_key = key
/datum/atom_hud/alternate_appearance/Destroy()
if(!QDELETED(src))
for(var/v in hudusers)
remove_hud_from(v)
for(var/v in hudatoms)
remove_from_hud(v)
GLOB.active_alternate_appearances -= src
return ..()
for(var/v in hudusers)
remove_hud_from(v)
for(var/v in hudatoms)
remove_from_hud(v)
GLOB.active_alternate_appearances -= src
return ..()
/datum/atom_hud/alternate_appearance/proc/onNewMob(mob/M)
if(mobShouldSee(M))

View File

@@ -1,19 +0,0 @@
diff a/code/game/alternate_appearance.dm b/code/game/alternate_appearance.dm (rejected hunks)
@@ -29,12 +29,11 @@ GLOBAL_LIST_EMPTY(active_alternate_appearances)
appearance_key = key
/datum/atom_hud/alternate_appearance/Destroy()
- if(!QDELETED(src))
- for(var/v in hudusers)
- remove_hud_from(v)
- for(var/v in hudatoms)
- remove_from_hud(v)
- GLOB.active_alternate_appearances -= src
+ for(var/v in hudusers)
+ remove_hud_from(v)
+ for(var/v in hudatoms)
+ remove_from_hud(v)
+ GLOB.active_alternate_appearances -= src
return ..()
/datum/atom_hud/alternate_appearance/proc/onNewMob(mob/M)

View File

@@ -30,6 +30,8 @@
can_ride_typecache = typecacheof(can_ride_typecache)
hook_vr("mob_new",list(src))
for(var/v in GLOB.active_alternate_appearances)
if(!v)
continue
var/datum/atom_hud/alternate_appearance/AA = v
AA.onNewMob(src)
..()

View File

@@ -1,10 +0,0 @@
diff a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm (rejected hunks)
@@ -29,6 +29,8 @@
prepare_huds()
can_ride_typecache = typecacheof(can_ride_typecache)
for(var/v in GLOB.active_alternate_appearances)
+ if(!v)
+ continue
var/datum/atom_hud/alternate_appearance/AA = v
AA.onNewMob(src)
..()