mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
Makes the global materials lookup lazily initialized
This commit is contained in:
@@ -4,10 +4,6 @@
|
|||||||
/// Hard materials, such as iron or metal
|
/// Hard materials, such as iron or metal
|
||||||
#define MAT_CATEGORY_RIGID "rigid material"
|
#define MAT_CATEGORY_RIGID "rigid material"
|
||||||
|
|
||||||
|
|
||||||
/// Gets the reference for the material type that was given
|
|
||||||
#define getmaterialref(A) (SSmaterials.materials[A] || A)
|
|
||||||
|
|
||||||
/// Flag for atoms, this flag ensures it isn't re-colored by materials. Useful for snowflake icons such as default toolboxes.
|
/// Flag for atoms, this flag ensures it isn't re-colored by materials. Useful for snowflake icons such as default toolboxes.
|
||||||
#define MATERIAL_COLOR (1<<0)
|
#define MATERIAL_COLOR (1<<0)
|
||||||
#define MATERIAL_ADD_PREFIX (1<<1)
|
#define MATERIAL_ADD_PREFIX (1<<1)
|
||||||
|
|||||||
@@ -107,7 +107,6 @@
|
|||||||
#define INIT_ORDER_INPUT 85
|
#define INIT_ORDER_INPUT 85
|
||||||
#define INIT_ORDER_VIS 80
|
#define INIT_ORDER_VIS 80
|
||||||
#define INIT_ORDER_ACHIEVEMENTS 77
|
#define INIT_ORDER_ACHIEVEMENTS 77
|
||||||
#define INIT_ORDER_MATERIALS 76
|
|
||||||
#define INIT_ORDER_RESEARCH 75
|
#define INIT_ORDER_RESEARCH 75
|
||||||
#define INIT_ORDER_EVENTS 70
|
#define INIT_ORDER_EVENTS 70
|
||||||
#define INIT_ORDER_JOBS 65
|
#define INIT_ORDER_JOBS 65
|
||||||
|
|||||||
@@ -7,12 +7,11 @@ These materials call on_applied() on whatever item they are applied to, common e
|
|||||||
|
|
||||||
SUBSYSTEM_DEF(materials)
|
SUBSYSTEM_DEF(materials)
|
||||||
name = "Materials"
|
name = "Materials"
|
||||||
flags = SS_NO_FIRE
|
flags = SS_NO_FIRE | SS_NO_INIT
|
||||||
init_order = INIT_ORDER_MATERIALS
|
|
||||||
///Dictionary of material.type || material ref
|
///Dictionary of material.type || material ref
|
||||||
var/list/materials = list()
|
var/list/materials = list()
|
||||||
///Dictionary of category || list of material refs
|
///Dictionary of category || list of material refs
|
||||||
var/list/materials_by_category = list()
|
var/list/materials_by_category = list()
|
||||||
///List of stackcrafting recipes for materials using rigid materials
|
///List of stackcrafting recipes for materials using rigid materials
|
||||||
var/list/rigid_stack_recipes = list(
|
var/list/rigid_stack_recipes = list(
|
||||||
new /datum/stack_recipe("chair", /obj/structure/chair/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE),
|
new /datum/stack_recipe("chair", /obj/structure/chair/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE),
|
||||||
@@ -20,14 +19,15 @@ SUBSYSTEM_DEF(materials)
|
|||||||
new /datum/stack_recipe("sink", /obj/structure/sink/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE),
|
new /datum/stack_recipe("sink", /obj/structure/sink/greyscale, one_per_turf = TRUE, on_floor = TRUE, applies_mats = TRUE),
|
||||||
)
|
)
|
||||||
|
|
||||||
/datum/controller/subsystem/materials/Initialize(timeofday)
|
|
||||||
InitializeMaterials()
|
|
||||||
return ..()
|
|
||||||
|
|
||||||
///Ran on initialize, populated the materials and materials_by_category dictionaries with their appropiate vars (See these variables for more info)
|
///Ran on initialize, populated the materials and materials_by_category dictionaries with their appropiate vars (See these variables for more info)
|
||||||
/datum/controller/subsystem/materials/proc/InitializeMaterials(timeofday)
|
/datum/controller/subsystem/materials/proc/InitializeMaterials()
|
||||||
for(var/type in subtypesof(/datum/material))
|
for(var/type in subtypesof(/datum/material))
|
||||||
var/datum/material/ref = new type
|
var/datum/material/ref = new type
|
||||||
materials[type] = ref
|
materials[type] = ref
|
||||||
for(var/c in ref.categories)
|
for(var/c in ref.categories)
|
||||||
materials_by_category[c] += list(ref)
|
materials_by_category[c] += list(ref)
|
||||||
|
|
||||||
|
/datum/controller/subsystem/materials/proc/GetMaterialRef(datum/material/fakemat)
|
||||||
|
if(!materials)
|
||||||
|
InitializeMaterials()
|
||||||
|
return materials[fakemat] || fakemat
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/OnExamine)
|
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/OnExamine)
|
||||||
|
|
||||||
for(var/mat in mat_list) //Make the assoc list ref | amount
|
for(var/mat in mat_list) //Make the assoc list ref | amount
|
||||||
var/datum/material/M = getmaterialref(mat) || mat
|
var/datum/material/M = SSmaterials.GetMaterialRef(mat)
|
||||||
materials[M] = 0
|
materials[M] = 0
|
||||||
|
|
||||||
/datum/component/material_container/proc/OnExamine(datum/source, mob/user)
|
/datum/component/material_container/proc/OnExamine(datum/source, mob/user)
|
||||||
@@ -128,9 +128,9 @@
|
|||||||
return primary_mat
|
return primary_mat
|
||||||
|
|
||||||
/// For inserting an amount of material
|
/// For inserting an amount of material
|
||||||
/datum/component/material_container/proc/insert_amount_mat(amt, var/datum/material/mat)
|
/datum/component/material_container/proc/insert_amount_mat(amt, var/datum/material/mat)
|
||||||
if(!istype(mat))
|
if(!istype(mat))
|
||||||
mat = getmaterialref(mat)
|
mat = SSmaterials.GetMaterialRef(mat)
|
||||||
if(amt > 0 && has_space(amt))
|
if(amt > 0 && has_space(amt))
|
||||||
var/total_amount_saved = total_amount
|
var/total_amount_saved = total_amount
|
||||||
if(mat)
|
if(mat)
|
||||||
@@ -143,9 +143,9 @@
|
|||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/// Uses an amount of a specific material, effectively removing it.
|
/// Uses an amount of a specific material, effectively removing it.
|
||||||
/datum/component/material_container/proc/use_amount_mat(amt, var/datum/material/mat)
|
/datum/component/material_container/proc/use_amount_mat(amt, var/datum/material/mat)
|
||||||
if(!istype(mat))
|
if(!istype(mat))
|
||||||
mat = getmaterialref(mat)
|
mat = SSmaterials.GetMaterialRef(mat)
|
||||||
var/amount = materials[mat]
|
var/amount = materials[mat]
|
||||||
if(mat)
|
if(mat)
|
||||||
if(amount >= amt)
|
if(amount >= amt)
|
||||||
@@ -155,9 +155,9 @@
|
|||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/// Proc for transfering materials to another container.
|
/// Proc for transfering materials to another container.
|
||||||
/datum/component/material_container/proc/transer_amt_to(var/datum/component/material_container/T, amt, var/datum/material/mat)
|
/datum/component/material_container/proc/transer_amt_to(var/datum/component/material_container/T, amt, var/datum/material/mat)
|
||||||
if(!istype(mat))
|
if(!istype(mat))
|
||||||
mat = getmaterialref(mat)
|
mat = SSmaterials.GetMaterialRef(mat)
|
||||||
if((amt==0)||(!T)||(!mat))
|
if((amt==0)||(!T)||(!mat))
|
||||||
return FALSE
|
return FALSE
|
||||||
if(amt<0)
|
if(amt<0)
|
||||||
@@ -184,13 +184,13 @@
|
|||||||
/datum/component/material_container/proc/use_materials(list/mats, multiplier=1)
|
/datum/component/material_container/proc/use_materials(list/mats, multiplier=1)
|
||||||
if(!mats || !length(mats))
|
if(!mats || !length(mats))
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
var/list/mats_to_remove = list() //Assoc list MAT | AMOUNT
|
var/list/mats_to_remove = list() //Assoc list MAT | AMOUNT
|
||||||
|
|
||||||
for(var/x in mats) //Loop through all required materials
|
for(var/x in mats) //Loop through all required materials
|
||||||
var/datum/material/req_mat = x
|
var/datum/material/req_mat = x
|
||||||
if(!istype(req_mat))
|
if(!istype(req_mat))
|
||||||
req_mat = getmaterialref(req_mat) //Get the ref if necesary
|
req_mat = SSmaterials.GetMaterialRef(req_mat) //Get the ref if necesary
|
||||||
if(!materials[req_mat]) //Do we have the resource?
|
if(!materials[req_mat]) //Do we have the resource?
|
||||||
return FALSE //Can't afford it
|
return FALSE //Can't afford it
|
||||||
var/amount_required = mats[x] * multiplier
|
var/amount_required = mats[x] * multiplier
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
return FALSE //Can't afford it
|
return FALSE //Can't afford it
|
||||||
mats_to_remove[req_mat] += amount_required //Add it to the assoc list of things to remove
|
mats_to_remove[req_mat] += amount_required //Add it to the assoc list of things to remove
|
||||||
continue
|
continue
|
||||||
|
|
||||||
var/total_amount_save = total_amount
|
var/total_amount_save = total_amount
|
||||||
|
|
||||||
for(var/i in mats_to_remove)
|
for(var/i in mats_to_remove)
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
return total_amount_save - total_amount
|
return total_amount_save - total_amount
|
||||||
|
|
||||||
/// For spawning mineral sheets at a specific location. Used by machines to output sheets.
|
/// For spawning mineral sheets at a specific location. Used by machines to output sheets.
|
||||||
/datum/component/material_container/proc/retrieve_sheets(sheet_amt, var/datum/material/M, target = null)
|
/datum/component/material_container/proc/retrieve_sheets(sheet_amt, var/datum/material/M, target = null)
|
||||||
if(!M.sheet_type)
|
if(!M.sheet_type)
|
||||||
return 0 //Add greyscale sheet handling here later
|
return 0 //Add greyscale sheet handling here later
|
||||||
if(sheet_amt <= 0)
|
if(sheet_amt <= 0)
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/// Proc to get all the materials and dump them as sheets
|
/// Proc to get all the materials and dump them as sheets
|
||||||
/datum/component/material_container/proc/retrieve_all(target = null)
|
/datum/component/material_container/proc/retrieve_all(target = null)
|
||||||
var/result = 0
|
var/result = 0
|
||||||
for(var/MAT in materials)
|
for(var/MAT in materials)
|
||||||
var/amount = materials[MAT]
|
var/amount = materials[MAT]
|
||||||
@@ -251,7 +251,7 @@
|
|||||||
var/datum/material/req_mat = x
|
var/datum/material/req_mat = x
|
||||||
if(!istype(req_mat))
|
if(!istype(req_mat))
|
||||||
if(ispath(req_mat)) //Is this an actual material, or is it a category?
|
if(ispath(req_mat)) //Is this an actual material, or is it a category?
|
||||||
req_mat = getmaterialref(req_mat) //Get the ref
|
req_mat = SSmaterials.GetMaterialRef(req_mat) //Get the ref
|
||||||
|
|
||||||
else // Its a category. (For example MAT_CATEGORY_RIGID)
|
else // Its a category. (For example MAT_CATEGORY_RIGID)
|
||||||
if(!has_enough_of_category(req_mat, mats[x], multiplier)) //Do we have enough of this category?
|
if(!has_enough_of_category(req_mat, mats[x], multiplier)) //Do we have enough of this category?
|
||||||
@@ -265,7 +265,7 @@
|
|||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
/// Returns all the categories in a recipe.
|
/// Returns all the categories in a recipe.
|
||||||
/datum/component/material_container/proc/get_categories(list/mats)
|
/datum/component/material_container/proc/get_categories(list/mats)
|
||||||
var/list/categories = list()
|
var/list/categories = list()
|
||||||
for(var/x in mats) //Loop through all required materials
|
for(var/x in mats) //Loop through all required materials
|
||||||
if(!istext(x)) //This means its not a category
|
if(!istext(x)) //This means its not a category
|
||||||
@@ -275,12 +275,12 @@
|
|||||||
|
|
||||||
|
|
||||||
/// Returns TRUE if you have enough of the specified material.
|
/// Returns TRUE if you have enough of the specified material.
|
||||||
/datum/component/material_container/proc/has_enough_of_material(var/datum/material/req_mat, amount, multiplier=1)
|
/datum/component/material_container/proc/has_enough_of_material(var/datum/material/req_mat, amount, multiplier=1)
|
||||||
if(!materials[req_mat]) //Do we have the resource?
|
if(!materials[req_mat]) //Do we have the resource?
|
||||||
return FALSE //Can't afford it
|
return FALSE //Can't afford it
|
||||||
var/amount_required = amount * multiplier
|
var/amount_required = amount * multiplier
|
||||||
if(materials[req_mat] >= amount_required) // do we have enough of the resource?
|
if(materials[req_mat] >= amount_required) // do we have enough of the resource?
|
||||||
return TRUE
|
return TRUE
|
||||||
return FALSE //Can't afford it
|
return FALSE //Can't afford it
|
||||||
|
|
||||||
/// Returns TRUE if you have enough of a specified material category (Which could be multiple materials)
|
/// Returns TRUE if you have enough of a specified material category (Which could be multiple materials)
|
||||||
@@ -292,7 +292,7 @@
|
|||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
/// Turns a material amount into the amount of sheets it should output
|
/// Turns a material amount into the amount of sheets it should output
|
||||||
/datum/component/material_container/proc/amount2sheet(amt)
|
/datum/component/material_container/proc/amount2sheet(amt)
|
||||||
if(amt >= MINERAL_MATERIAL_AMOUNT)
|
if(amt >= MINERAL_MATERIAL_AMOUNT)
|
||||||
return round(amt / MINERAL_MATERIAL_AMOUNT)
|
return round(amt / MINERAL_MATERIAL_AMOUNT)
|
||||||
return FALSE
|
return FALSE
|
||||||
@@ -314,7 +314,7 @@
|
|||||||
return material_amount
|
return material_amount
|
||||||
|
|
||||||
/// Returns the amount of a specific material in this container.
|
/// Returns the amount of a specific material in this container.
|
||||||
/datum/component/material_container/proc/get_material_amount(var/datum/material/mat)
|
/datum/component/material_container/proc/get_material_amount(var/datum/material/mat)
|
||||||
if(!istype(mat))
|
if(!istype(mat))
|
||||||
mat = getmaterialref(mat)
|
mat = SSmaterials.GetMaterialRef(mat)
|
||||||
return(materials[mat])
|
return(materials[mat])
|
||||||
|
|||||||
@@ -161,7 +161,7 @@
|
|||||||
|
|
||||||
var/temp_list = list()
|
var/temp_list = list()
|
||||||
for(var/i in custom_materials)
|
for(var/i in custom_materials)
|
||||||
temp_list[getmaterialref(i)] = custom_materials[i] //Get the proper instanced version
|
temp_list[SSmaterials.GetMaterialRef(i)] = custom_materials[i] //Get the proper instanced version
|
||||||
|
|
||||||
custom_materials = null //Null the list to prepare for applying the materials properly
|
custom_materials = null //Null the list to prepare for applying the materials properly
|
||||||
set_custom_materials(temp_list)
|
set_custom_materials(temp_list)
|
||||||
@@ -1204,7 +1204,7 @@
|
|||||||
|
|
||||||
if(custom_materials) //Only runs if custom materials existed at first. Should usually be the case but check anyways
|
if(custom_materials) //Only runs if custom materials existed at first. Should usually be the case but check anyways
|
||||||
for(var/i in custom_materials)
|
for(var/i in custom_materials)
|
||||||
var/datum/material/custom_material = getmaterialref(i)
|
var/datum/material/custom_material = SSmaterials.GetMaterialRef(i)
|
||||||
custom_material.on_removed(src, material_flags) //Remove the current materials
|
custom_material.on_removed(src, material_flags) //Remove the current materials
|
||||||
|
|
||||||
if(!length(materials))
|
if(!length(materials))
|
||||||
@@ -1213,7 +1213,7 @@
|
|||||||
custom_materials = list() //Reset the list
|
custom_materials = list() //Reset the list
|
||||||
|
|
||||||
for(var/x in materials)
|
for(var/x in materials)
|
||||||
var/datum/material/custom_material = getmaterialref(x)
|
var/datum/material/custom_material = SSmaterials.GetMaterialRef(x)
|
||||||
|
|
||||||
if(!(material_flags & MATERIAL_NO_EFFECTS))
|
if(!(material_flags & MATERIAL_NO_EFFECTS))
|
||||||
custom_material.on_applied(src, materials[custom_material] * multiplier * material_modifier, material_flags)
|
custom_material.on_applied(src, materials[custom_material] * multiplier * material_modifier, material_flags)
|
||||||
|
|||||||
@@ -142,7 +142,7 @@
|
|||||||
/obj/machinery/autolathe/proc/AfterMaterialInsert(item_inserted, id_inserted, amount_inserted)
|
/obj/machinery/autolathe/proc/AfterMaterialInsert(item_inserted, id_inserted, amount_inserted)
|
||||||
if(istype(item_inserted, /obj/item/stack/ore/bluespace_crystal))
|
if(istype(item_inserted, /obj/item/stack/ore/bluespace_crystal))
|
||||||
use_power(MINERAL_MATERIAL_AMOUNT / 10)
|
use_power(MINERAL_MATERIAL_AMOUNT / 10)
|
||||||
else if(custom_materials && custom_materials.len && custom_materials[getmaterialref(/datum/material/glass)])
|
else if(custom_materials && custom_materials.len && custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)])
|
||||||
flick("autolathe_r",src)//plays glass insertion animation by default otherwise
|
flick("autolathe_r",src)//plays glass insertion animation by default otherwise
|
||||||
else
|
else
|
||||||
flick("autolathe_o",src)//plays metal insertion animation
|
flick("autolathe_o",src)//plays metal insertion animation
|
||||||
|
|||||||
@@ -66,8 +66,8 @@
|
|||||||
if(iswallturf(T))
|
if(iswallturf(T))
|
||||||
T.attackby(src, user, params)
|
T.attackby(src, user, params)
|
||||||
|
|
||||||
var/metal_amt = round(custom_materials[getmaterialref(/datum/material/iron)]/MINERAL_MATERIAL_AMOUNT) //Replace this shit later
|
var/metal_amt = round(custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]/MINERAL_MATERIAL_AMOUNT) //Replace this shit later
|
||||||
var/glass_amt = round(custom_materials[getmaterialref(/datum/material/glass)]/MINERAL_MATERIAL_AMOUNT) //Replace this shit later
|
var/glass_amt = round(custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)]/MINERAL_MATERIAL_AMOUNT) //Replace this shit later
|
||||||
|
|
||||||
if(W.tool_behaviour == TOOL_WRENCH && (metal_amt || glass_amt))
|
if(W.tool_behaviour == TOOL_WRENCH && (metal_amt || glass_amt))
|
||||||
to_chat(user, "<span class='notice'>You dismantle [src].</span>")
|
to_chat(user, "<span class='notice'>You dismantle [src].</span>")
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
mats_per_unit = list()
|
mats_per_unit = list()
|
||||||
var/in_process_mat_list = custom_materials.Copy()
|
var/in_process_mat_list = custom_materials.Copy()
|
||||||
for(var/i in custom_materials)
|
for(var/i in custom_materials)
|
||||||
mats_per_unit[getmaterialref(i)] = in_process_mat_list[i]
|
mats_per_unit[SSmaterials.GetMaterialRef(i)] = in_process_mat_list[i]
|
||||||
custom_materials[i] *= amount
|
custom_materials[i] *= amount
|
||||||
. = ..()
|
. = ..()
|
||||||
if(merge)
|
if(merge)
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
var/list/temp_recipes = get_main_recipes()
|
var/list/temp_recipes = get_main_recipes()
|
||||||
recipes = temp_recipes.Copy()
|
recipes = temp_recipes.Copy()
|
||||||
if(material_type)
|
if(material_type)
|
||||||
var/datum/material/M = getmaterialref(material_type) //First/main material
|
var/datum/material/M = SSmaterials.GetMaterialRef(material_type) //First/main material
|
||||||
for(var/i in M.categories)
|
for(var/i in M.categories)
|
||||||
switch(i)
|
switch(i)
|
||||||
if(MAT_CATEGORY_RIGID)
|
if(MAT_CATEGORY_RIGID)
|
||||||
@@ -236,7 +236,7 @@
|
|||||||
if(R.applies_mats && custom_materials && custom_materials.len)
|
if(R.applies_mats && custom_materials && custom_materials.len)
|
||||||
var/list/used_materials = list()
|
var/list/used_materials = list()
|
||||||
for(var/i in custom_materials)
|
for(var/i in custom_materials)
|
||||||
used_materials[getmaterialref(i)] = R.req_amount / R.res_amount * (MINERAL_MATERIAL_AMOUNT / custom_materials.len)
|
used_materials[SSmaterials.GetMaterialRef(i)] = R.req_amount / R.res_amount * (MINERAL_MATERIAL_AMOUNT / custom_materials.len)
|
||||||
O.set_custom_materials(used_materials)
|
O.set_custom_materials(used_materials)
|
||||||
|
|
||||||
//START: oh fuck i'm so sorry
|
//START: oh fuck i'm so sorry
|
||||||
|
|||||||
@@ -314,7 +314,7 @@
|
|||||||
if(remaining_mats)
|
if(remaining_mats)
|
||||||
for(var/M=1 to remaining_mats)
|
for(var/M=1 to remaining_mats)
|
||||||
new stack_type(get_turf(loc))
|
new stack_type(get_turf(loc))
|
||||||
else if(custom_materials[getmaterialref(/datum/material/iron)])
|
else if(custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)])
|
||||||
new /obj/item/stack/rods(get_turf(loc), 2)
|
new /obj/item/stack/rods(get_turf(loc), 2)
|
||||||
qdel(src)
|
qdel(src)
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@
|
|||||||
|
|
||||||
/obj/item/IntegrateAmount() //returns the amount of resources gained when eating this item
|
/obj/item/IntegrateAmount() //returns the amount of resources gained when eating this item
|
||||||
if(custom_materials)
|
if(custom_materials)
|
||||||
if(custom_materials[getmaterialref(/datum/material/iron)] || custom_materials[getmaterialref(/datum/material/glass)])
|
if(custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] || custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)])
|
||||||
return 1
|
return 1
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
if(!isitem(O))
|
if(!isitem(O))
|
||||||
return 0
|
return 0
|
||||||
var/obj/item/I = O
|
var/obj/item/I = O
|
||||||
if(!(getmaterialref(material_id) in I.custom_materials))
|
if(!(SSmaterials.GetMaterialRef(material_id) in I.custom_materials))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/amount = I.custom_materials[getmaterialref(material_id)]
|
var/amount = I.custom_materials[SSmaterials.GetMaterialRef(material_id)]
|
||||||
|
|
||||||
if(istype(I, /obj/item/stack/ore))
|
if(istype(I, /obj/item/stack/ore))
|
||||||
amount *= 0.8 // Station's ore redemption equipment is really goddamn good.
|
amount *= 0.8 // Station's ore redemption equipment is really goddamn good.
|
||||||
|
|||||||
@@ -310,8 +310,8 @@
|
|||||||
for(var/obj/item/O in ingredients)
|
for(var/obj/item/O in ingredients)
|
||||||
O.microwave_act(src)
|
O.microwave_act(src)
|
||||||
if(O.custom_materials && length(O.custom_materials))
|
if(O.custom_materials && length(O.custom_materials))
|
||||||
if(O.custom_materials[getmaterialref(/datum/material/iron)])
|
if(O.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)])
|
||||||
metal += O.custom_materials[getmaterialref(/datum/material/iron)]
|
metal += O.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]
|
||||||
|
|
||||||
if(metal)
|
if(metal)
|
||||||
spark()
|
spark()
|
||||||
|
|||||||
@@ -194,7 +194,7 @@
|
|||||||
dat += "<A href='?src=[REF(src)];create=[D.id];amount=5'>x5</A>"
|
dat += "<A href='?src=[REF(src)];create=[D.id];amount=5'>x5</A>"
|
||||||
if(ispath(D.build_path, /obj/item/stack))
|
if(ispath(D.build_path, /obj/item/stack))
|
||||||
dat += "<A href='?src=[REF(src)];create=[D.id];amount=10'>x10</A>"
|
dat += "<A href='?src=[REF(src)];create=[D.id];amount=10'>x10</A>"
|
||||||
dat += "([D.materials[getmaterialref(/datum/material/biomass)]/efficiency])<br>"
|
dat += "([D.materials[SSmaterials.GetMaterialRef(/datum/material/biomass)]/efficiency])<br>"
|
||||||
dat += "</div>"
|
dat += "</div>"
|
||||||
else
|
else
|
||||||
dat += "<div class='statusDisplay'>No container inside, please insert container.</div>"
|
dat += "<div class='statusDisplay'>No container inside, please insert container.</div>"
|
||||||
@@ -236,14 +236,14 @@
|
|||||||
menustat = "void"
|
menustat = "void"
|
||||||
|
|
||||||
/obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = TRUE)
|
/obj/machinery/biogenerator/proc/check_cost(list/materials, multiplier = 1, remove_points = TRUE)
|
||||||
if(materials.len != 1 || materials[1] != getmaterialref(/datum/material/biomass))
|
if(materials.len != 1 || materials[1] != SSmaterials.GetMaterialRef(/datum/material/biomass))
|
||||||
return FALSE
|
return FALSE
|
||||||
if (materials[getmaterialref(/datum/material/biomass)]*multiplier/efficiency > points)
|
if (materials[SSmaterials.GetMaterialRef(/datum/material/biomass)]*multiplier/efficiency > points)
|
||||||
menustat = "nopoints"
|
menustat = "nopoints"
|
||||||
return FALSE
|
return FALSE
|
||||||
else
|
else
|
||||||
if(remove_points)
|
if(remove_points)
|
||||||
points -= materials[getmaterialref(/datum/material/biomass)]*multiplier/efficiency
|
points -= materials[SSmaterials.GetMaterialRef(/datum/material/biomass)]*multiplier/efficiency
|
||||||
update_icon()
|
update_icon()
|
||||||
updateUsrDialog()
|
updateUsrDialog()
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
proximity_monitor = new(src, 1)
|
proximity_monitor = new(src, 1)
|
||||||
AddComponent(/datum/component/material_container, list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/gold, /datum/material/diamond, /datum/material/plasma, /datum/material/uranium, /datum/material/bananium, /datum/material/titanium, /datum/material/bluespace), INFINITY, TRUE, /obj/item/stack)
|
AddComponent(/datum/component/material_container, list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/gold, /datum/material/diamond, /datum/material/plasma, /datum/material/uranium, /datum/material/bananium, /datum/material/titanium, /datum/material/bluespace), INFINITY, TRUE, /obj/item/stack)
|
||||||
stored_research = new /datum/techweb/specialized/autounlocking/smelter
|
stored_research = new /datum/techweb/specialized/autounlocking/smelter
|
||||||
selected_material = getmaterialref(/datum/material/iron)
|
selected_material = SSmaterials.GetMaterialRef(/datum/material/iron)
|
||||||
|
|
||||||
/obj/machinery/mineral/processing_unit/Destroy()
|
/obj/machinery/mineral/processing_unit/Destroy()
|
||||||
CONSOLE = null
|
CONSOLE = null
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
/datum/material/plastic,
|
/datum/material/plastic,
|
||||||
/datum/material/runite
|
/datum/material/runite
|
||||||
), MINERAL_MATERIAL_AMOUNT * 75, FALSE, /obj/item/stack)
|
), MINERAL_MATERIAL_AMOUNT * 75, FALSE, /obj/item/stack)
|
||||||
chosen = getmaterialref(chosen)
|
chosen = SSmaterials.GetMaterialRef(chosen)
|
||||||
|
|
||||||
|
|
||||||
/obj/machinery/mineral/mint/process()
|
/obj/machinery/mineral/mint/process()
|
||||||
|
|||||||
@@ -83,8 +83,8 @@
|
|||||||
|
|
||||||
if(is_type_in_list(S, list(/obj/item/stack/sheet/metal, /obj/item/stack/rods, /obj/item/stack/tile/plasteel)))
|
if(is_type_in_list(S, list(/obj/item/stack/sheet/metal, /obj/item/stack/rods, /obj/item/stack/tile/plasteel)))
|
||||||
if(S.custom_materials && custom_materials.len)
|
if(S.custom_materials && custom_materials.len)
|
||||||
if(S.custom_materials[getmaterialref(/datum/material/iron)])
|
if(S.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)])
|
||||||
S.cost = S.custom_materials[getmaterialref(/datum/material/iron)] * 0.25
|
S.cost = S.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)] * 0.25
|
||||||
S.source = get_or_create_estorage(/datum/robot_energy_storage/metal)
|
S.source = get_or_create_estorage(/datum/robot_energy_storage/metal)
|
||||||
|
|
||||||
else if(istype(S, /obj/item/stack/sheet/glass))
|
else if(istype(S, /obj/item/stack/sheet/glass))
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
nummies.Cut()
|
nummies.Cut()
|
||||||
nummies += loc.contents
|
nummies += loc.contents
|
||||||
if(prob(5) && random_retaliate)
|
if(prob(5) && random_retaliate)
|
||||||
Retaliate()
|
Retaliate()
|
||||||
|
|
||||||
/mob/living/simple_animal/hostile/retaliate/goose/handle_automated_action()
|
/mob/living/simple_animal/hostile/retaliate/goose/handle_automated_action()
|
||||||
if(length(nummies))
|
if(length(nummies))
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
/mob/living/simple_animal/hostile/retaliate/goose/vomit/handle_automated_action()
|
/mob/living/simple_animal/hostile/retaliate/goose/vomit/handle_automated_action()
|
||||||
if(length(nummies))
|
if(length(nummies))
|
||||||
var/obj/item/E = pick(nummies)
|
var/obj/item/E = pick(nummies)
|
||||||
if(!(E.custom_materials && E.custom_materials[getmaterialref(/datum/material/plastic)]))
|
if(!(E.custom_materials && E.custom_materials[SSmaterials.GetMaterialRef(/datum/material/plastic)]))
|
||||||
nummies -= E // remove non-plastic item from queue
|
nummies -= E // remove non-plastic item from queue
|
||||||
E = locate(/obj/item/reagent_containers/food) in nummies // find food
|
E = locate(/obj/item/reagent_containers/food) in nummies // find food
|
||||||
if(E && E.loc == loc)
|
if(E && E.loc == loc)
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
/mob/living/simple_animal/hostile/retaliate/goose/proc/feed(obj/item/suffocator)
|
/mob/living/simple_animal/hostile/retaliate/goose/proc/feed(obj/item/suffocator)
|
||||||
if(stat == DEAD || choking) // plapatin I swear to god
|
if(stat == DEAD || choking) // plapatin I swear to god
|
||||||
return FALSE
|
return FALSE
|
||||||
if(suffocator.custom_materials && suffocator.custom_materials[getmaterialref(/datum/material/plastic)]) // dumb goose'll swallow food or drink with plastic in it
|
if(suffocator.custom_materials && suffocator.custom_materials[SSmaterials.GetMaterialRef(/datum/material/plastic)]) // dumb goose'll swallow food or drink with plastic in it
|
||||||
visible_message("<span class='danger'>[src] hungrily gobbles up \the [suffocator]! </span>")
|
visible_message("<span class='danger'>[src] hungrily gobbles up \the [suffocator]! </span>")
|
||||||
visible_message("<span class='boldwarning'>[src] is choking on \the [suffocator]! </span>")
|
visible_message("<span class='boldwarning'>[src] is choking on \the [suffocator]! </span>")
|
||||||
suffocator.forceMove(src)
|
suffocator.forceMove(src)
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ other types of metals and chemistry for reagents).
|
|||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/datum/design/proc/InitializeMaterials()
|
/datum/design/proc/InitializeMaterials()
|
||||||
var/list/temp_list = list()
|
var/list/temp_list = list()
|
||||||
for(var/i in materials) //Go through all of our materials, get the subsystem instance, and then replace the list.
|
for(var/i in materials) //Go through all of our materials, get the subsystem instance, and then replace the list.
|
||||||
var/amount = materials[i]
|
var/amount = materials[i]
|
||||||
if(!istext(i)) //Not a category, so get the ref the normal way
|
if(!istext(i)) //Not a category, so get the ref the normal way
|
||||||
var/datum/material/M = getmaterialref(i)
|
var/datum/material/M = SSmaterials.GetMaterialRef(i)
|
||||||
temp_list[M] = amount
|
temp_list[M] = amount
|
||||||
else
|
else
|
||||||
temp_list[i] = amount
|
temp_list[i] = amount
|
||||||
|
|||||||
Reference in New Issue
Block a user