Porting a couple material datums code updates and fixes.
This commit is contained in:
@@ -4,11 +4,8 @@
|
|||||||
/// 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)
|
||||||
#define MATERIAL_NO_EFFECTS (1<<2)
|
#define MATERIAL_NO_EFFECTS (1<<2)
|
||||||
|
#define MATERIAL_AFFECT_STATISTICS (1<<3)
|
||||||
@@ -56,7 +56,6 @@
|
|||||||
#define INIT_ORDER_SERVER_MAINT 93
|
#define INIT_ORDER_SERVER_MAINT 93
|
||||||
#define INIT_ORDER_INPUT 85
|
#define INIT_ORDER_INPUT 85
|
||||||
#define INIT_ORDER_VIS 80
|
#define INIT_ORDER_VIS 80
|
||||||
#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
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ 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
|
||||||
@@ -14,14 +13,15 @@ SUBSYSTEM_DEF(materials)
|
|||||||
///List of stackcrafting recipes for materials using rigid materials
|
///List of stackcrafting recipes for materials using rigid materials
|
||||||
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))
|
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))
|
||||||
|
|
||||||
/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, list/examine_list)
|
/datum/component/material_container/proc/OnExamine(datum/source, mob/user, list/examine_list)
|
||||||
@@ -130,7 +130,7 @@
|
|||||||
/// 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)
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
/// 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)
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
/// 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)
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
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
|
||||||
@@ -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[req_mat], multiplier)) //Do we have enough of this category?
|
if(!has_enough_of_category(req_mat, mats[req_mat], multiplier)) //Do we have enough of this category?
|
||||||
@@ -316,5 +316,5 @@
|
|||||||
/// 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])
|
||||||
|
|||||||
@@ -41,20 +41,21 @@ Simple datum which is instanced once per type and is used for every object of sa
|
|||||||
|
|
||||||
///This proc is called when the material is added to an object specifically.
|
///This proc is called when the material is added to an object specifically.
|
||||||
/datum/material/proc/on_applied_obj(var/obj/o, amount, material_flags)
|
/datum/material/proc/on_applied_obj(var/obj/o, amount, material_flags)
|
||||||
var/new_max_integrity = CEILING(o.max_integrity * integrity_modifier, 1)
|
if(material_flags & MATERIAL_AFFECT_STATISTICS)
|
||||||
o.modify_max_integrity(new_max_integrity)
|
var/new_max_integrity = CEILING(o.max_integrity * integrity_modifier, 1)
|
||||||
o.force *= strength_modifier
|
o.modify_max_integrity(new_max_integrity)
|
||||||
o.throwforce *= strength_modifier
|
o.force *= strength_modifier
|
||||||
|
o.throwforce *= strength_modifier
|
||||||
|
|
||||||
var/list/temp_armor_list = list() //Time to add armor modifiers!
|
var/list/temp_armor_list = list() //Time to add armor modifiers!
|
||||||
|
|
||||||
if(!istype(o.armor))
|
if(!istype(o.armor))
|
||||||
return
|
return
|
||||||
var/list/current_armor = o.armor?.getList()
|
var/list/current_armor = o.armor?.getList()
|
||||||
|
|
||||||
for(var/i in current_armor)
|
for(var/i in current_armor)
|
||||||
temp_armor_list[i] = current_armor[i] * armor_modifiers[i]
|
temp_armor_list[i] = current_armor[i] * armor_modifiers[i]
|
||||||
o.armor = getArmor(arglist(temp_armor_list))
|
o.armor = getArmor(arglist(temp_armor_list))
|
||||||
|
|
||||||
///This proc is called when the material is removed from an object.
|
///This proc is called when the material is removed from an object.
|
||||||
/datum/material/proc/on_removed(atom/source, material_flags)
|
/datum/material/proc/on_removed(atom/source, material_flags)
|
||||||
@@ -71,7 +72,8 @@ Simple datum which is instanced once per type and is used for every object of sa
|
|||||||
|
|
||||||
///This proc is called when the material is removed from an object specifically.
|
///This proc is called when the material is removed from an object specifically.
|
||||||
/datum/material/proc/on_removed_obj(var/obj/o, amount, material_flags)
|
/datum/material/proc/on_removed_obj(var/obj/o, amount, material_flags)
|
||||||
var/new_max_integrity = initial(o.max_integrity)
|
if(material_flags & MATERIAL_AFFECT_STATISTICS)
|
||||||
o.modify_max_integrity(new_max_integrity)
|
var/new_max_integrity = initial(o.max_integrity)
|
||||||
o.force = initial(o.force)
|
o.modify_max_integrity(new_max_integrity)
|
||||||
o.throwforce = initial(o.throwforce)
|
o.force = initial(o.force)
|
||||||
|
o.throwforce = initial(o.throwforce)
|
||||||
|
|||||||
+3
-3
@@ -98,7 +98,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)
|
||||||
|
|
||||||
@@ -904,7 +904,7 @@ Proc for attack log creation, because really why not
|
|||||||
|
|
||||||
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))
|
||||||
@@ -913,7 +913,7 @@ Proc for attack log creation, because really why not
|
|||||||
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)
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
/obj/machinery/autolathe/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted)
|
/obj/machinery/autolathe/proc/AfterMaterialInsert(obj/item/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(item_inserted.custom_materials?.len && item_inserted.custom_materials[getmaterialref(/datum/material/glass)])
|
else if(item_inserted.custom_materials?.len && item_inserted.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
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/obj/machinery/autoylathe/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted)
|
/obj/machinery/autoylathe/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted)
|
||||||
if(item_inserted.custom_materials?.len && item_inserted.custom_materials[getmaterialref(/datum/material/glass)])
|
if(item_inserted.custom_materials?.len && item_inserted.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)
|
var/metal_amt = round(custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]/MINERAL_MATERIAL_AMOUNT)
|
||||||
var/glass_amt = round(custom_materials[getmaterialref(/datum/material/glass)]/MINERAL_MATERIAL_AMOUNT)
|
var/glass_amt = round(custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)]/MINERAL_MATERIAL_AMOUNT)
|
||||||
|
|
||||||
if(istype(W, /obj/item/wrench) && (metal_amt || glass_amt))
|
if(istype(W, /obj/item/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>")
|
||||||
|
|||||||
@@ -514,7 +514,7 @@
|
|||||||
item_state = "mace_greyscale"
|
item_state = "mace_greyscale"
|
||||||
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
|
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
|
||||||
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
|
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
|
||||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR //Material type changes the prefix as well as the color.
|
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS //Material type changes the prefix as well as the color.
|
||||||
custom_materials = list(/datum/material/iron = 12000) //Defaults to an Iron Mace.
|
custom_materials = list(/datum/material/iron = 12000) //Defaults to an Iron Mace.
|
||||||
slot_flags = ITEM_SLOT_BELT
|
slot_flags = ITEM_SLOT_BELT
|
||||||
force = 14
|
force = 14
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
merge_type = type
|
merge_type = type
|
||||||
if(custom_materials && custom_materials.len)
|
if(custom_materials && custom_materials.len)
|
||||||
for(var/i in custom_materials)
|
for(var/i in custom_materials)
|
||||||
custom_materials[getmaterialref(i)] = mats_per_stack * amount
|
custom_materials[SSmaterials.GetMaterialRef(i)] = mats_per_stack * amount
|
||||||
. = ..()
|
. = ..()
|
||||||
if(merge)
|
if(merge)
|
||||||
for(var/obj/item/stack/S in loc)
|
for(var/obj/item/stack/S in loc)
|
||||||
@@ -57,7 +57,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)
|
||||||
@@ -225,7 +225,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
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
src.amount += amount
|
src.amount += amount
|
||||||
if(custom_materials && custom_materials.len)
|
if(custom_materials && custom_materials.len)
|
||||||
for(var/i in custom_materials)
|
for(var/i in custom_materials)
|
||||||
custom_materials[getmaterialref(i)] = MINERAL_MATERIAL_AMOUNT * src.amount
|
custom_materials[SSmaterials.GetMaterialRef(i)] = MINERAL_MATERIAL_AMOUNT * src.amount
|
||||||
set_custom_materials() //Refresh
|
set_custom_materials() //Refresh
|
||||||
update_icon()
|
update_icon()
|
||||||
update_weight()
|
update_weight()
|
||||||
|
|||||||
@@ -153,7 +153,7 @@
|
|||||||
///Material chair
|
///Material chair
|
||||||
/obj/structure/chair/greyscale
|
/obj/structure/chair/greyscale
|
||||||
icon_state = "chair_greyscale"
|
icon_state = "chair_greyscale"
|
||||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR
|
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
|
||||||
item_chair = /obj/item/chair/greyscale
|
item_chair = /obj/item/chair/greyscale
|
||||||
buildstacktype = null //Custom mats handle this
|
buildstacktype = null //Custom mats handle this
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@
|
|||||||
/obj/item/chair/greyscale
|
/obj/item/chair/greyscale
|
||||||
icon_state = "chair_greyscale_toppled"
|
icon_state = "chair_greyscale_toppled"
|
||||||
item_state = "chair_greyscale"
|
item_state = "chair_greyscale"
|
||||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR
|
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
|
||||||
origin_type = /obj/structure/chair/greyscale
|
origin_type = /obj/structure/chair/greyscale
|
||||||
|
|
||||||
/obj/item/chair/stool
|
/obj/item/chair/stool
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
make_new_table(material.tableVariant)
|
make_new_table(material.tableVariant)
|
||||||
else
|
else
|
||||||
if(material.get_amount() < 1)
|
if(material.get_amount() < 1)
|
||||||
to_chat(user, "<span class='warning'>You need one metal sheet to do this!</span>")
|
to_chat(user, "<span class='warning'>You need one sheet to do this!</span>")
|
||||||
return
|
return
|
||||||
to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
|
to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
|
||||||
if(do_after(user, 20, target = src) && material.use(1))
|
if(do_after(user, 20, target = src) && material.use(1))
|
||||||
|
|||||||
@@ -212,7 +212,7 @@
|
|||||||
/obj/structure/table/greyscale
|
/obj/structure/table/greyscale
|
||||||
icon = 'icons/obj/smooth_structures/table_greyscale.dmi'
|
icon = 'icons/obj/smooth_structures/table_greyscale.dmi'
|
||||||
icon_state = "table"
|
icon_state = "table"
|
||||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR
|
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
|
||||||
buildstack = null //No buildstack, so generate from mat datums
|
buildstack = null //No buildstack, so generate from mat datums
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -191,7 +191,7 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
/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[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 ..()
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,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.
|
||||||
|
|||||||
@@ -243,7 +243,7 @@
|
|||||||
icon_state = "knight_greyscale"
|
icon_state = "knight_greyscale"
|
||||||
item_state = "knight_greyscale"
|
item_state = "knight_greyscale"
|
||||||
armor = list("melee" = 35, "bullet" = 10, "laser" = 10, "energy" = 10, "bomb" = 10, "bio" = 10, "rad" = 10, "fire" = 40, "acid" = 40)
|
armor = list("melee" = 35, "bullet" = 10, "laser" = 10, "energy" = 10, "bomb" = 10, "bio" = 10, "rad" = 10, "fire" = 40, "acid" = 40)
|
||||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR //Can change color and add prefix
|
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS //Can change color and add prefix
|
||||||
|
|
||||||
/obj/item/clothing/head/helmet/skull
|
/obj/item/clothing/head/helmet/skull
|
||||||
name = "skull helmet"
|
name = "skull helmet"
|
||||||
|
|||||||
@@ -267,7 +267,7 @@
|
|||||||
icon_state = "knight_greyscale"
|
icon_state = "knight_greyscale"
|
||||||
item_state = "knight_greyscale"
|
item_state = "knight_greyscale"
|
||||||
armor = list("melee" = 35, "bullet" = 10, "laser" = 10, "energy" = 10, "bomb" = 10, "bio" = 10, "rad" = 10, "fire" = 40, "acid" = 40)
|
armor = list("melee" = 35, "bullet" = 10, "laser" = 10, "energy" = 10, "bomb" = 10, "bio" = 10, "rad" = 10, "fire" = 40, "acid" = 40)
|
||||||
material_flags = MATERIAL_ADD_PREFIX //Can change color and add prefix
|
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS //Can change color and add prefix
|
||||||
|
|
||||||
/obj/item/clothing/suit/armor/vest/durathread
|
/obj/item/clothing/suit/armor/vest/durathread
|
||||||
name = "makeshift vest"
|
name = "makeshift vest"
|
||||||
|
|||||||
@@ -310,7 +310,7 @@
|
|||||||
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?.len)
|
if(O.custom_materials?.len)
|
||||||
metal += O.custom_materials[getmaterialref(/datum/material/iron)]
|
metal += O.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]
|
||||||
|
|
||||||
if(metal)
|
if(metal)
|
||||||
spark()
|
spark()
|
||||||
|
|||||||
@@ -196,7 +196,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>"
|
||||||
@@ -233,14 +233,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
|
||||||
|
|||||||
@@ -190,10 +190,10 @@
|
|||||||
var/cost = 400
|
var/cost = 400
|
||||||
if(ispath(build_type, /obj/item/electronic_assembly))
|
if(ispath(build_type, /obj/item/electronic_assembly))
|
||||||
var/obj/item/electronic_assembly/E = SScircuit.cached_assemblies[build_type]
|
var/obj/item/electronic_assembly/E = SScircuit.cached_assemblies[build_type]
|
||||||
cost = E.custom_materials[getmaterialref(/datum/material/iron)]
|
cost = E.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]
|
||||||
else if(ispath(build_type, /obj/item/integrated_circuit))
|
else if(ispath(build_type, /obj/item/integrated_circuit))
|
||||||
var/obj/item/integrated_circuit/IC = SScircuit.cached_components[build_type]
|
var/obj/item/integrated_circuit/IC = SScircuit.cached_components[build_type]
|
||||||
cost = IC.custom_materials[getmaterialref(/datum/material/iron)]
|
cost = IC.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]
|
||||||
else if(!(build_type in SScircuit.circuit_fabricator_recipe_list["Tools"]))
|
else if(!(build_type in SScircuit.circuit_fabricator_recipe_list["Tools"]))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -260,7 +260,7 @@
|
|||||||
blocks["max_space"] = assembly.max_components
|
blocks["max_space"] = assembly.max_components
|
||||||
|
|
||||||
// Start keeping track of total metal cost
|
// Start keeping track of total metal cost
|
||||||
blocks["metal_cost"] = assembly.custom_materials[getmaterialref(/datum/material/iron)]
|
blocks["metal_cost"] = assembly.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]
|
||||||
|
|
||||||
|
|
||||||
// Block 2. Components.
|
// Block 2. Components.
|
||||||
@@ -291,7 +291,7 @@
|
|||||||
// Update estimated assembly complexity, taken space and material cost
|
// Update estimated assembly complexity, taken space and material cost
|
||||||
blocks["complexity"] += component.complexity
|
blocks["complexity"] += component.complexity
|
||||||
blocks["used_space"] += component.size
|
blocks["used_space"] += component.size
|
||||||
blocks["metal_cost"] += component.custom_materials[getmaterialref(/datum/material/iron)]
|
blocks["metal_cost"] += component.custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]
|
||||||
|
|
||||||
// Check if the assembly requires printer upgrades
|
// Check if the assembly requires printer upgrades
|
||||||
if(!(component.spawn_flags & IC_SPAWN_DEFAULT))
|
if(!(component.spawn_flags & IC_SPAWN_DEFAULT))
|
||||||
|
|||||||
@@ -414,7 +414,7 @@
|
|||||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||||
set_pin_data(IC_OUTPUT, 2, materials.total_amount)
|
set_pin_data(IC_OUTPUT, 2, materials.total_amount)
|
||||||
for(var/I in 1 to mtypes.len)
|
for(var/I in 1 to mtypes.len)
|
||||||
var/datum/material/M = materials.materials[getmaterialref(I)]
|
var/datum/material/M = materials.materials[SSmaterials.GetMaterialRef(I)]
|
||||||
var/amount = materials[M]
|
var/amount = materials[M]
|
||||||
if(M)
|
if(M)
|
||||||
set_pin_data(IC_OUTPUT, I+2, amount)
|
set_pin_data(IC_OUTPUT, I+2, amount)
|
||||||
@@ -452,7 +452,7 @@
|
|||||||
continue
|
continue
|
||||||
if(!mt) //Invalid input
|
if(!mt) //Invalid input
|
||||||
if(U>0)
|
if(U>0)
|
||||||
if(materials.retrieve_sheets(U, getmaterialref(mtypes[I]), T))
|
if(materials.retrieve_sheets(U, SSmaterials.GetMaterialRef(mtypes[I]), T))
|
||||||
suc = TRUE
|
suc = TRUE
|
||||||
else
|
else
|
||||||
if(mt.transer_amt_to(materials, U, mtypes[I]))
|
if(mt.transer_amt_to(materials, U, mtypes[I]))
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
/datum/material/plastic,
|
/datum/material/plastic,
|
||||||
/datum/material/runite
|
/datum/material/runite
|
||||||
), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack)
|
), MINERAL_MATERIAL_AMOUNT * 50, FALSE, /obj/item/stack)
|
||||||
chosen = getmaterialref(chosen)
|
chosen = SSmaterials.GetMaterialRef(chosen)
|
||||||
|
|
||||||
/obj/machinery/mineral/mint/process()
|
/obj/machinery/mineral/mint/process()
|
||||||
var/turf/T = get_step(src, input_dir)
|
var/turf/T = get_step(src, input_dir)
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
|
|||||||
throwforce = 2
|
throwforce = 2
|
||||||
w_class = WEIGHT_CLASS_TINY
|
w_class = WEIGHT_CLASS_TINY
|
||||||
custom_materials = list(/datum/material/iron = 400)
|
custom_materials = list(/datum/material/iron = 400)
|
||||||
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR
|
material_flags = MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
|
||||||
var/string_attached
|
var/string_attached
|
||||||
var/list/sideslist = list("heads","tails")
|
var/list/sideslist = list("heads","tails")
|
||||||
var/cooldown = 0
|
var/cooldown = 0
|
||||||
|
|||||||
@@ -97,8 +97,8 @@
|
|||||||
var/obj/item/stack/S = I
|
var/obj/item/stack/S = I
|
||||||
|
|
||||||
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?.len && S.custom_materials[getmaterialref(/datum/material/iron)])
|
if(S.custom_materials?.len && 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))
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ other types of metals and chemistry for reagents).
|
|||||||
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