From 187ecee177ccfba2cb961fdd4eae071735c33b5d Mon Sep 17 00:00:00 2001 From: "elly1989@rocketmail.com" Date: Wed, 1 Aug 2012 19:27:09 +0000 Subject: [PATCH] Added global lists for chemistry datums. chemical_reactions_list for storing /datum/chemical_reaction so we don't have to spawn them all everytime two reagents get mixed together. chemical_reagents_list, unlike reactions it is indexed by id so we can have fast lookup of reagent data. Again, without spawning everytype of that datum everytime we add a reagent to something It was making all subtypes of this datum everytime it filled any reagent_container with a single reagent. Considering how many reagent containers there are that's a lot of wastage. Now it only does this once, thank goodness. Unfortunately I had to stick the initialisation inside the datum/reagents holder object's New() proc, since New() for map ojects gets called before world/New() Fixed clean_blood() yet again *sigh*. It's probably as good as I'm gonna get it without changing loadsa stuff needlessly. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4273 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/procs/global_lists.dm | 2 + code/game/atom_procs.dm | 72 +++++++++---------- code/game/gamemodes/events/ninja_equipment.dm | 2 +- code/game/objects/watercloset.dm | 20 +++--- code/modules/chemical/Chemistry-Holder.dm | 51 ++++++++----- code/modules/chemical/Chemistry-Machinery.dm | 33 +++++---- code/modules/chemical/Chemistry-Reagents.dm | 20 +++--- 7 files changed, 106 insertions(+), 94 deletions(-) diff --git a/code/defines/procs/global_lists.dm b/code/defines/procs/global_lists.dm index 30e6e64dfdc..315277b131e 100644 --- a/code/defines/procs/global_lists.dm +++ b/code/defines/procs/global_lists.dm @@ -10,6 +10,8 @@ var/global/list/client_list = list()//List of all clients, based on ckey var/global/list/cable_list = list()//Index for all cables, so that powernets don't have to look through the entire world all the time var/global/list/hair_styles_list = list() //stores /datum/sprite_accessory/hair indexed by name var/global/list/facial_hair_styles_list = list() //stores /datum/sprite_accessory/facial_hair indexed by name +var/global/list/chemical_reactions_list //list of all /datum/chemical_reaction datums. Used during chemical reactions +var/global/list/chemical_reagents_list //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff ////////////////////////// /////Initial Building///// diff --git a/code/game/atom_procs.dm b/code/game/atom_procs.dm index 689e1c14ff8..37d0a4d0f69 100644 --- a/code/game/atom_procs.dm +++ b/code/game/atom_procs.dm @@ -281,10 +281,7 @@ this.viruses += newDisease newDisease.holder = this - - -/atom/proc/clean_blood() - +/atom/proc/clean_prints() if(istype(fingerprints, /list)) //Smudge up dem prints some for(var/P in fingerprints) @@ -296,44 +293,43 @@ if(!fingerprints.len) del(fingerprints) +/atom/proc/clean_blood() if(istype(blood_DNA, /list)) - //Cleaning blood off of mobs - if(istype(src, /mob/living/carbon)) - var/mob/living/carbon/M = src - del(M.blood_DNA) - if(ishuman(M)) - var/mob/living/carbon/human/H = M - if(H.gloves) - H.gloves.clean_blood() -// H.update_inv_gloves(0) //Needs to be called even if we aren't wearing gloves. - else - H.bloody_hands = 0 - H.update_inv_gloves(0) //because it handles bloody hands too - M.update_icons() //apply the now updated overlays to the mob + del(blood_DNA) + .=1 - //Cleaning blood off of items - else if(istype(src, /obj/item)) - var/obj/item/O = src - del(O.blood_DNA) - if(O.blood_overlay) - O.overlays.Remove(O.blood_overlay) - - if(istype(src, /obj/item/clothing/gloves)) - var/obj/item/clothing/gloves/G = src - G.transfer_blood = 0 - - //Cleaning blood off of turfs - else if(istype(src, /turf/simulated)) - var/turf/simulated/T = src - del(T.blood_DNA) - if(T.icon_old) - var/icon/I = new /icon(T.icon_old, T.icon_state) - T.icon = I + //Cleaning blood off of mobs + if(istype(src, /mob/living/carbon)) + var/mob/living/carbon/M = src + if(ishuman(M)) + var/mob/living/carbon/human/H = M + if(H.gloves) + if(H.gloves.clean_blood()) + H.update_inv_gloves(0) else - T.icon = initial(icon) + if(H.bloody_hands) + H.bloody_hands = 0 + H.update_inv_gloves(0) + M.update_icons() //apply the now updated overlays to the mob - else if(!blood_DNA.len) - del(blood_DNA) + //Cleaning blood off of items + else if(istype(src, /obj/item)) + var/obj/item/O = src + if(O.blood_overlay) + O.overlays.Remove(O.blood_overlay) + + if(istype(src, /obj/item/clothing/gloves)) + var/obj/item/clothing/gloves/G = src + G.transfer_blood = 0 + + //Cleaning blood off of turfs + else if(istype(src, /turf/simulated)) + var/turf/simulated/T = src + if(T.icon_old) + var/icon/I = new /icon(T.icon_old, T.icon_state) + T.icon = I + else + T.icon = initial(icon) return /atom/MouseDrop(atom/over_object as mob|obj|turf|area) diff --git a/code/game/gamemodes/events/ninja_equipment.dm b/code/game/gamemodes/events/ninja_equipment.dm index ad152e5cb6f..f3646abb149 100644 --- a/code/game/gamemodes/events/ninja_equipment.dm +++ b/code/game/gamemodes/events/ninja_equipment.dm @@ -465,7 +465,7 @@ ________________________________________________________________________________ if(t_disk) dat += "Eject Disk
" dat += "