From 9957da080d9c0152d2dbd3893d4e7e6332497dc7 Mon Sep 17 00:00:00 2001 From: Atermonera Date: Tue, 16 Jun 2020 00:28:49 -0700 Subject: [PATCH] Merge pull request #7283 from MistakeNot4892/supmat Generalizes supply points per material sheet to the material datum. --- code/controllers/subsystems/supply.dm | 23 +++-------------------- code/modules/materials/materials.dm | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/code/controllers/subsystems/supply.dm b/code/controllers/subsystems/supply.dm index 0ba67f8ab6..ad14c1e6cd 100644 --- a/code/controllers/subsystems/supply.dm +++ b/code/controllers/subsystems/supply.dm @@ -23,23 +23,6 @@ SUBSYSTEM_DEF(supply) //shuttle movement var/movetime = 1200 var/datum/shuttle/autodock/ferry/supply/shuttle - var/list/material_points_conversion = list( // Any materials not named in this list are worth 0 points - "silver" = 2, - "marble" = 2, - "gold" = 2, - "uranium" = 2, - "lead" = 2, - "platinum" = 5, - "phoron" = 5, - "titanium" = 6, - "plasteel" = 6, - "osmium" = 6, - "mhydrogen" = 6, - "verdantium" = 8, - "diamond" = 8, - "durasteel" = 9, - "morphium" = 13 - )//SPOOKY number! /datum/controller/subsystem/supply/Initialize() ordernum = rand(1,9000) @@ -52,7 +35,6 @@ SUBSYSTEM_DEF(supply) else qdel(P) - // TODO - Auto-build material_points_conversion from material datums . = ..() // Supply shuttle ticker - handles supply point regeneration. Just add points over time. @@ -123,8 +105,9 @@ SUBSYSTEM_DEF(supply) // Sell phoron and platinum if(istype(A, /obj/item/stack)) var/obj/item/stack/P = A - if(material_points_conversion[P.get_material_name()]) - EC.contents[EC.contents.len]["value"] = P.get_amount() * material_points_conversion[P.get_material_name()] + var/material/mat = P.get_material() + if(mat?.supply_conversion_value) + EC.contents[EC.contents.len]["value"] = P.get_amount() * mat.supply_conversion_value EC.contents[EC.contents.len]["quantity"] = P.get_amount() EC.value += EC.contents[EC.contents.len]["value"] diff --git a/code/modules/materials/materials.dm b/code/modules/materials/materials.dm index 2da552c5b1..eb1a76b32c 100644 --- a/code/modules/materials/materials.dm +++ b/code/modules/materials/materials.dm @@ -114,6 +114,7 @@ var/list/name_to_material var/list/composite_material // If set, object matter var will be a list containing these values. var/luminescence var/radiation_resistance = 0 // Radiation resistance, which is added on top of a material's weight for blocking radiation. Needed to make lead special without superrobust weapons. + var/supply_conversion_value // Supply points per sheet that this material sells for. // Placeholder vars for the time being, todo properly integrate windows/light tiles/rods. var/created_window @@ -256,6 +257,7 @@ var/list/name_to_material weight = 22 stack_origin_tech = list(TECH_MATERIAL = 5) door_icon_base = "stone" + supply_conversion_value = 2 /material/diamond name = "diamond" @@ -271,6 +273,7 @@ var/list/name_to_material tableslam_noise = 'sound/effects/Glasshit.ogg' hardness = 100 stack_origin_tech = list(TECH_MATERIAL = 6) + supply_conversion_value = 8 /material/gold name = "gold" @@ -282,6 +285,7 @@ var/list/name_to_material stack_origin_tech = list(TECH_MATERIAL = 4) sheet_singular_name = "ingot" sheet_plural_name = "ingots" + supply_conversion_value = 2 /material/gold/bronze //placeholder for ashtrays name = "bronze" @@ -297,6 +301,7 @@ var/list/name_to_material stack_origin_tech = list(TECH_MATERIAL = 3) sheet_singular_name = "ingot" sheet_plural_name = "ingots" + supply_conversion_value = 2 //R-UST port /material/supermatter @@ -329,6 +334,7 @@ var/list/name_to_material door_icon_base = "stone" sheet_singular_name = "crystal" sheet_plural_name = "crystals" + supply_conversion_value = 5 /* // Commenting this out while fires are so spectacularly lethal, as I can't seem to get this balanced appropriately. @@ -370,6 +376,7 @@ var/list/name_to_material hardness = 30 //VOREStation Edit - Please. integrity = 201 //hack to stop kitchen benches being flippable, todo: refactor into weight system stack_type = /obj/item/stack/material/marble + supply_conversion_value = 2 /material/steel name = DEFAULT_WALL_MATERIAL @@ -428,6 +435,7 @@ var/list/name_to_material conductivity = 13 // For the purposes of balance. stack_origin_tech = list(TECH_MATERIAL = 2) composite_material = list(DEFAULT_WALL_MATERIAL = SHEET_MATERIAL_AMOUNT, "platinum" = SHEET_MATERIAL_AMOUNT) //todo + supply_conversion_value = 6 /material/plasteel/hull name = MAT_PLASTEELHULL @@ -457,6 +465,7 @@ var/list/name_to_material reflectivity = 0.7 // Not a perfect mirror, but close. stack_origin_tech = list(TECH_MATERIAL = 8) composite_material = list("plasteel" = SHEET_MATERIAL_AMOUNT, "diamond" = SHEET_MATERIAL_AMOUNT) //shrug + supply_conversion_value = 9 /material/durasteel/hull //The 'Hardball' of starship hulls. name = MAT_DURASTEELHULL @@ -676,6 +685,7 @@ var/list/name_to_material sheet_singular_name = "ingot" sheet_plural_name = "ingots" conductivity = 100 + supply_conversion_value = 6 /material/tritium name = "tritium" @@ -704,6 +714,7 @@ var/list/name_to_material stack_origin_tech = list(TECH_MATERIAL = 6, TECH_POWER = 6, TECH_MAGNET = 5) conductivity = 100 is_fusion_fuel = 1 + supply_conversion_value = 6 /material/platinum name = "platinum" @@ -714,6 +725,7 @@ var/list/name_to_material stack_origin_tech = list(TECH_MATERIAL = 2) sheet_singular_name = "ingot" sheet_plural_name = "ingots" + supply_conversion_value = 5 /material/iron name = "iron" @@ -733,6 +745,7 @@ var/list/name_to_material sheet_singular_name = "ingot" sheet_plural_name = "ingots" radiation_resistance = 25 // Lead is Special and so gets to block more radiation than it normally would with just weight, totalling in 48 protection. + supply_conversion_value = 2 // Particle Smasher and other exotic materials. @@ -755,6 +768,7 @@ var/list/name_to_material stack_origin_tech = list(TECH_MATERIAL = 6, TECH_POWER = 5, TECH_BIO = 4) sheet_singular_name = "sheet" sheet_plural_name = "sheets" + supply_conversion_value = 8 /material/morphium name = MAT_MORPHIUM @@ -775,6 +789,7 @@ var/list/name_to_material reflectivity = 0.2 radiation_resistance = 10 stack_origin_tech = list(TECH_MATERIAL = 8, TECH_ILLEGAL = 1, TECH_PHORON = 4, TECH_BLUESPACE = 4, TECH_ARCANE = 1) + supply_conversion_value = 13 /material/morphium/hull name = MAT_MORPHIUMHULL