mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-01-01 04:52:16 +00:00
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
This commit is contained in:
@@ -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/////
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -465,7 +465,7 @@ ________________________________________________________________________________
|
||||
if(t_disk)
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Eject Disk'>Eject Disk</a><br>"
|
||||
dat += "<ul>"
|
||||
if(stored_research.len)//If there is stored research. Should be but just in case.
|
||||
if(istype(stored_research,/list))//If there is stored research. Should be but just in case.
|
||||
for(var/datum/tech/current_data in stored_research)
|
||||
dat += "<li>"
|
||||
dat += "[current_data.name]: [current_data.level]"
|
||||
|
||||
@@ -208,22 +208,22 @@
|
||||
if(M.l_hand)
|
||||
M.l_hand.clean_blood()
|
||||
if(M.wear_mask)
|
||||
M.wear_mask.clean_blood()
|
||||
M.update_inv_wear_mask(0)
|
||||
if(M.wear_mask.clean_blood())
|
||||
M.update_inv_wear_mask(0)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(H.head)
|
||||
H.head.clean_blood()
|
||||
H.update_inv_head(0)
|
||||
if(H.head.clean_blood())
|
||||
H.update_inv_head(0)
|
||||
if(H.wear_suit)
|
||||
H.wear_suit.clean_blood()
|
||||
H.update_inv_wear_suit(0)
|
||||
if(H.wear_suit.clean_blood())
|
||||
H.update_inv_wear_suit(0)
|
||||
else if(H.w_uniform)
|
||||
H.w_uniform.clean_blood()
|
||||
H.update_inv_w_uniform(0)
|
||||
if(H.w_uniform.clean_blood())
|
||||
H.update_inv_w_uniform(0)
|
||||
if(H.shoes)
|
||||
H.shoes.clean_blood()
|
||||
H.update_inv_shoes(0)
|
||||
if(H.shoes.clean_blood())
|
||||
H.update_inv_shoes(0)
|
||||
|
||||
O.clean_blood()
|
||||
|
||||
|
||||
@@ -15,6 +15,22 @@ datum
|
||||
New(maximum=100)
|
||||
maximum_volume = maximum
|
||||
|
||||
//I dislike having these here but map-objects are initialised before world/New() is called. >_>
|
||||
if(!chemical_reagents_list)
|
||||
//Chemical Reagents - Initialises all /datum/reagent into a list indexed by reagent id
|
||||
var/paths = typesof(/datum/reagent) - /datum/reagent
|
||||
chemical_reagents_list = list()
|
||||
for(var/path in paths)
|
||||
var/datum/reagent/D = new path()
|
||||
chemical_reagents_list[D.id] = D
|
||||
if(!chemical_reactions_list)
|
||||
//Chemical Reactions - Initialises all /datum/chemical_reaction into a list (without an index)
|
||||
var/paths = typesof(/datum/chemical_reaction) - /datum/chemical_reaction
|
||||
chemical_reactions_list = list()
|
||||
for(var/path in paths)
|
||||
var/datum/chemical_reaction/D = new path()
|
||||
chemical_reactions_list += D
|
||||
|
||||
proc
|
||||
|
||||
remove_any(var/amount=1)
|
||||
@@ -182,8 +198,7 @@ datum
|
||||
var/reaction_occured = 0
|
||||
do
|
||||
reaction_occured = 0
|
||||
for(var/A in typesof(/datum/chemical_reaction) - /datum/chemical_reaction)
|
||||
var/datum/chemical_reaction/C = new A()
|
||||
for(var/datum/chemical_reaction/C in chemical_reactions_list)
|
||||
var/total_required_reagents = C.required_reagents.len
|
||||
var/total_matching_reagents = 0
|
||||
var/total_required_catalysts = C.required_catalysts.len
|
||||
@@ -349,22 +364,22 @@ datum
|
||||
handle_reactions()
|
||||
return 0
|
||||
|
||||
for(var/A in typesof(/datum/reagent) - /datum/reagent)
|
||||
var/datum/reagent/R = new A()
|
||||
if (R.id == reagent)
|
||||
reagent_list += R
|
||||
R.holder = src
|
||||
R.volume = amount
|
||||
R.data = data
|
||||
//debug
|
||||
//world << "Adding data"
|
||||
//for(var/D in R.data)
|
||||
// world << "Container data: [D] = [R.data[D]]"
|
||||
//debug
|
||||
update_total()
|
||||
my_atom.on_reagent_change()
|
||||
handle_reactions()
|
||||
return 0
|
||||
var/datum/reagent/D = chemical_reagents_list[reagent]
|
||||
if(D)
|
||||
var/datum/reagent/R = new D.type()
|
||||
reagent_list += R
|
||||
R.holder = src
|
||||
R.volume = amount
|
||||
R.data = data
|
||||
//debug
|
||||
//world << "Adding data"
|
||||
//for(var/D in R.data)
|
||||
// world << "Container data: [D] = [R.data[D]]"
|
||||
//debug
|
||||
update_total()
|
||||
my_atom.on_reagent_change()
|
||||
handle_reactions()
|
||||
return 0
|
||||
|
||||
handle_reactions()
|
||||
|
||||
|
||||
@@ -74,24 +74,23 @@
|
||||
winset(user, "chemdispenser.eject", "text=\"\[Insert beaker\]\"")
|
||||
/obj/machinery/chem_dispenser/proc/initWindow(mob/user as mob)
|
||||
var/i = 0
|
||||
var list/nameparams = params2list(winget(user, "chemdispenser_reagents.template_name", "pos;size;type;image;image-mode"))
|
||||
var list/buttonparams = params2list(winget(user, "chemdispenser_reagents.template_dispense", "pos;size;type;image;image-mode;text;is-flat"))
|
||||
var/list/nameparams = params2list(winget(user, "chemdispenser_reagents.template_name", "pos;size;type;image;image-mode"))
|
||||
var/list/buttonparams = params2list(winget(user, "chemdispenser_reagents.template_dispense", "pos;size;type;image;image-mode;text;is-flat"))
|
||||
for(var/re in dispensable_reagents)
|
||||
for(var/da in typesof(/datum/reagent) - /datum/reagent)
|
||||
var/datum/reagent/temp = new da()
|
||||
if(temp.id == re)
|
||||
var list/newparams1 = nameparams.Copy()
|
||||
var list/newparams2 = buttonparams.Copy()
|
||||
var/posy = 8 + 40 * i
|
||||
newparams1["pos"] = text("8,[posy]")
|
||||
newparams2["pos"] = text("248,[posy]")
|
||||
newparams1["parent"] = "chemdispenser_reagents"
|
||||
newparams2["parent"] = "chemdispenser_reagents"
|
||||
newparams1["text"] = temp.name
|
||||
newparams2["command"] = text("skincmd \"chemdispenser;[temp.id]\"")
|
||||
winset(user, "chemdispenser_reagent_name[i]", list2params(newparams1))
|
||||
winset(user, "chemdispenser_reagent_dispense[i]", list2params(newparams2))
|
||||
i++
|
||||
var/datum/reagent/temp = chemical_reagents_list[re]
|
||||
if(temp)
|
||||
var/list/newparams1 = nameparams.Copy()
|
||||
var/list/newparams2 = buttonparams.Copy()
|
||||
var/posy = 8 + 40 * i
|
||||
newparams1["pos"] = text("8,[posy]")
|
||||
newparams2["pos"] = text("248,[posy]")
|
||||
newparams1["parent"] = "chemdispenser_reagents"
|
||||
newparams2["parent"] = "chemdispenser_reagents"
|
||||
newparams1["text"] = temp.name
|
||||
newparams2["command"] = text("skincmd \"chemdispenser;[temp.id]\"")
|
||||
winset(user, "chemdispenser_reagent_name[i]", list2params(newparams1))
|
||||
winset(user, "chemdispenser_reagent_dispense[i]", list2params(newparams2))
|
||||
i++
|
||||
winset(user, "chemdispenser_reagents", "size=340x[8 + 40 * i]")
|
||||
|
||||
/obj/machinery/chem_dispenser/SkinCmd(mob/user as mob, var/data as text)
|
||||
|
||||
@@ -1002,22 +1002,22 @@ datum
|
||||
if(C.l_hand)
|
||||
C.l_hand.clean_blood()
|
||||
if(C.wear_mask)
|
||||
C.wear_mask.clean_blood()
|
||||
C.update_inv_wear_mask(0)
|
||||
if(C.wear_mask.clean_blood())
|
||||
C.update_inv_wear_mask(0)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = C
|
||||
if(H.head)
|
||||
H.head.clean_blood()
|
||||
H.update_inv_head(0)
|
||||
if(H.head.clean_blood())
|
||||
H.update_inv_head(0)
|
||||
if(H.wear_suit)
|
||||
H.wear_suit.clean_blood()
|
||||
H.update_inv_wear_suit(0)
|
||||
if(H.wear_suit.clean_blood())
|
||||
H.update_inv_wear_suit(0)
|
||||
else if(H.w_uniform)
|
||||
H.w_uniform.clean_blood()
|
||||
H.update_inv_w_uniform(0)
|
||||
if(H.w_uniform.clean_blood())
|
||||
H.update_inv_w_uniform(0)
|
||||
if(H.shoes)
|
||||
H.shoes.clean_blood()
|
||||
H.update_inv_shoes(0)
|
||||
if(H.shoes.clean_blood())
|
||||
H.update_inv_shoes(0)
|
||||
M.clean_blood()
|
||||
|
||||
plantbgone
|
||||
|
||||
Reference in New Issue
Block a user