Porting a couple material datums code updates and fixes.

This commit is contained in:
Ghommie
2020-03-04 15:59:46 +01:00
parent 7a539d0a78
commit f2c8a7cd6f
28 changed files with 70 additions and 72 deletions

View File

@@ -66,8 +66,8 @@
if(iswallturf(T))
T.attackby(src, user, params)
var/metal_amt = round(custom_materials[getmaterialref(/datum/material/iron)]/MINERAL_MATERIAL_AMOUNT)
var/glass_amt = round(custom_materials[getmaterialref(/datum/material/glass)]/MINERAL_MATERIAL_AMOUNT)
var/metal_amt = round(custom_materials[SSmaterials.GetMaterialRef(/datum/material/iron)]/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))
to_chat(user, "<span class='notice'>You dismantle [src].</span>")

View File

@@ -514,7 +514,7 @@
item_state = "mace_greyscale"
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.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.
slot_flags = ITEM_SLOT_BELT
force = 14

View File

@@ -48,7 +48,7 @@
merge_type = type
if(custom_materials && custom_materials.len)
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)
for(var/obj/item/stack/S in loc)
@@ -57,7 +57,7 @@
var/list/temp_recipes = get_main_recipes()
recipes = temp_recipes.Copy()
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)
switch(i)
if(MAT_CATEGORY_RIGID)
@@ -225,7 +225,7 @@
if(R.applies_mats && custom_materials && custom_materials.len)
var/list/used_materials = list()
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)
//START: oh fuck i'm so sorry
@@ -347,7 +347,7 @@
src.amount += amount
if(custom_materials && custom_materials.len)
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
update_icon()
update_weight()

View File

@@ -153,7 +153,7 @@
///Material chair
/obj/structure/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
buildstacktype = null //Custom mats handle this
@@ -377,7 +377,7 @@
/obj/item/chair/greyscale
icon_state = "chair_greyscale_toppled"
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
/obj/item/chair/stool

View File

@@ -41,7 +41,7 @@
make_new_table(material.tableVariant)
else
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
to_chat(user, "<span class='notice'>You start adding [material] to [src]...</span>")
if(do_after(user, 20, target = src) && material.use(1))

View File

@@ -212,7 +212,7 @@
/obj/structure/table/greyscale
icon = 'icons/obj/smooth_structures/table_greyscale.dmi'
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
/*