optimize crew monitor's scan()

New global list, "clothing_list".

Signed-off-by: Mloc-Argent <colmohici@gmail.com>

Conflicts:
	code/__HELPERS/global_lists.dm
	code/modules/clothing/clothing.dm
This commit is contained in:
Mloc-Argent
2014-06-21 17:35:31 -04:00
committed by ZomgPonies
parent 1625d82487
commit 40b0ecf006
3 changed files with 43 additions and 9 deletions
+3
View File
@@ -22,6 +22,8 @@ var/global/list/side_effects = list() //list of all medical sideeffects types
var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking.
var/global/list/joblist = list() //list of all jobstypes, minus borg and AI
var/global/list/flag_list = list() //list of flags during Nations gamemode
var/global/list/clothing_list = list() //list of all /obj/item/clothing instances in the world
//Languages/species/whitelist.
var/global/list/all_species[0]
var/global/list/all_languages[0]
@@ -109,6 +111,7 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel", "Satchel Al
var/datum/language/L = new T
all_languages[L.name] = L
var/rkey = 0
paths = typesof(/datum/species)-/datum/species
for(var/T in paths)
+3 -9
View File
@@ -108,13 +108,7 @@
/obj/machinery/computer/crew/proc/scan()
for(var/obj/item/clothing/under/C in world)
for(var/obj/item/clothing/under/C in clothing_list)
if((C.has_sensor) && (istype(C.loc, /mob/living/carbon/human)))
var/check = 0
for(var/O in src.tracked)
if(O == C)
check = 1
break
if(!check)
src.tracked.Add(C)
return 1
tracked |= C
return 1
+37
View File
@@ -2,6 +2,14 @@
name = "clothing"
var/list/species_restricted = null //Only these species can wear this kit.
/obj/item/clothing/New()
. = ..()
clothing_list += src
/obj/item/clothing/Del()
clothing_list -= src
return ..()
//BS12: Species-restricted clothing check.
/obj/item/clothing/mob_can_equip(M as mob, slot)
@@ -281,6 +289,35 @@ BLIND // can't see anything
..()
/obj/item/clothing/under/attack_hand(mob/user as mob)
//only forward to the attached accessory if the clothing is equipped (not in a storage)
if(hastie && src.loc == user)
hastie.attack_hand(user)
return
if ((ishuman(usr) || ismonkey(usr)) && src.loc == user) //make it harder to accidentally undress yourself
return
..()
/obj/item/clothing/under/MouseDrop(obj/over_object as obj)
if (ishuman(usr) || ismonkey(usr))
//makes sure that the clothing is equipped so that we can't drag it into our hand from miles away.
if (!(src.loc == usr))
return
if (!( usr.restrained() ) && !( usr.stat ))
switch(over_object.name)
if("r_hand")
usr.u_equip(src)
usr.put_in_r_hand(src)
if("l_hand")
usr.u_equip(src)
usr.put_in_l_hand(src)
src.add_fingerprint(usr)
return
return
/obj/item/clothing/under/examine()
set src in view()
..()