Material Science 1: A bunch of math (#95090)

This commit is contained in:
SmArtKar
2026-02-22 16:53:51 +11:00
committed by GitHub
parent 6561c841d0
commit a3498fdcd7
95 changed files with 1816 additions and 1435 deletions
+5 -7
View File
@@ -152,7 +152,7 @@
materials = new ( \
src, \
SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \
SSmaterials.get_materials_by_flag(MATERIAL_SILO_STORED), \
INFINITY, \
MATCONTAINER_EXAMINE, \
allowed_items = accepted_type \
@@ -160,7 +160,7 @@
if(!GLOB.autounlock_techwebs[/datum/techweb/autounlocking/smelter])
GLOB.autounlock_techwebs[/datum/techweb/autounlocking/smelter] = new /datum/techweb/autounlocking/smelter
stored_research = GLOB.autounlock_techwebs[/datum/techweb/autounlocking/smelter]
selected_material = GET_MATERIAL_REF(/datum/material/iron)
selected_material = SSmaterials.get_material(/datum/material/iron)
/obj/machinery/mineral/processing_unit/Destroy()
QDEL_NULL(proximity_monitor)
@@ -267,16 +267,14 @@
generate_mineral(alloy.build_path)
/obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/D, seconds_per_tick = 2)
if(D.make_reagent)
/obj/machinery/mineral/processing_unit/proc/can_smelt(datum/design/design, seconds_per_tick = 2)
if(design.make_reagent)
return FALSE
var/build_amount = SMELT_AMOUNT * seconds_per_tick
for(var/mat_cat in D.materials)
var/required_amount = D.materials[mat_cat]
for(var/mat_cat, required_amount in design.materials)
var/amount = materials.materials[mat_cat]
build_amount = min(build_amount, round(amount / required_amount))
return build_amount
+6 -7
View File
@@ -91,15 +91,14 @@
points += gathered_ore.points * point_upgrade * gathered_ore.amount
/// Returns the amount of a specific alloy design, based on the accessible materials
/obj/machinery/mineral/ore_redemption/proc/can_smelt_alloy(datum/design/D)
/obj/machinery/mineral/ore_redemption/proc/can_smelt_alloy(datum/design/design)
var/datum/material_container/mat_container = materials.mat_container
if(!mat_container || D.make_reagent)
if(!mat_container || design.make_reagent)
return FALSE
var/build_amount = 0
for(var/mat in D.materials)
var/amount = D.materials[mat]
for(var/mat, amount in design.materials)
var/datum/material/redemption_mat_amount = mat_container.materials[mat]
if(!amount || !redemption_mat_amount)
@@ -371,11 +370,11 @@
if(amount < 1) //no negative mats
return
materials.use_materials(alloy.materials, multiplier = amount, action = "withdrawn", name = "sheets", user_data = ID_DATA(usr))
var/output
var/atom/movable/output
if(ispath(alloy.build_path, /obj/item/stack/sheet))
output = new alloy.build_path(src, amount)
output = alloy.create_result(src, amount = amount)
else
output = new alloy.build_path(src)
output = alloy.create_result(src)
unload_mineral(output)
else
to_chat(usr, span_warning("Required access not found."))
+1 -1
View File
@@ -73,7 +73,7 @@
materials = new ( \
src, \
SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \
SSmaterials.get_materials_by_flag(MATERIAL_SILO_STORED), \
INFINITY, \
MATCONTAINER_EXAMINE, \
container_signals = list( \
+7 -29
View File
@@ -438,7 +438,6 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
force = 1
throwforce = 2
w_class = WEIGHT_CLASS_TINY
custom_materials = list(/datum/material/iron = COIN_MATERIAL_AMOUNT)
material_flags = MATERIAL_EFFECTS | MATERIAL_ADD_PREFIX | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
var/string_attached
var/list/sideslist = list("heads","tails")
@@ -554,45 +553,27 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
/obj/item/coin/gold
custom_materials = list(/datum/material/gold = COIN_MATERIAL_AMOUNT)
/obj/item/coin/gold/grind_results()
return list(/datum/reagent/gold = 4)
/obj/item/coin/silver
custom_materials = list(/datum/material/silver = COIN_MATERIAL_AMOUNT)
/obj/item/coin/silver/grind_results()
return list(/datum/reagent/silver = 4)
/obj/item/coin/diamond
custom_materials = list(/datum/material/diamond = COIN_MATERIAL_AMOUNT)
/obj/item/coin/diamond/grind_results()
return list(/datum/reagent/carbon = 4)
/obj/item/coin/plasma
custom_materials = list(/datum/material/plasma = COIN_MATERIAL_AMOUNT)
/obj/item/coin/plasma/grind_results()
return list(/datum/reagent/toxin/plasma = 4)
/obj/item/coin/uranium
custom_materials = list(/datum/material/uranium = COIN_MATERIAL_AMOUNT)
/obj/item/coin/uranium/grind_results()
return list(/datum/reagent/uranium = 4)
/obj/item/coin/titanium
custom_materials = list(/datum/material/titanium = COIN_MATERIAL_AMOUNT)
/obj/item/coin/titanium/grind_results()
return list(/datum/reagent/flash_powder = 4)
return list(/datum/reagent/flash_powder = 8)
/obj/item/coin/bananium
custom_materials = list(/datum/material/bananium = COIN_MATERIAL_AMOUNT)
/obj/item/coin/bananium/grind_results()
return list(/datum/reagent/consumable/nutriment/soup/clown_tears = 4)
/obj/item/coin/adamantine
custom_materials = list(/datum/material/adamantine = COIN_MATERIAL_AMOUNT)
@@ -600,19 +581,16 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
custom_materials = list(/datum/material/mythril = COIN_MATERIAL_AMOUNT)
/obj/item/coin/mythril/grind_results()
return list(/datum/reagent/medicine/omnizine/godblood = 4)
return list(/datum/reagent/medicine/omnizine/godblood = 8)
/obj/item/coin/plastic
custom_materials = list(/datum/material/plastic = COIN_MATERIAL_AMOUNT)
/obj/item/coin/plastic/grind_results()
return list(/datum/reagent/plastic_polymers = 4)
/obj/item/coin/runite
custom_materials = list(/datum/material/runite = COIN_MATERIAL_AMOUNT)
/obj/item/coin/runite/grind_results()
return list(/datum/reagent/iron = 2, /datum/reagent/consumable/ethanol/ritual_wine = 2)
return list(/datum/reagent/iron = 4, /datum/reagent/consumable/ethanol/ritual_wine = 4)
/obj/item/coin/twoheaded
desc = "Hey, this coin's the same on both sides!"
@@ -629,17 +607,17 @@ GLOBAL_LIST_INIT(sand_recipes, list(\
override_material_worth = TRUE
/obj/item/coin/antagtoken/grind_results()
return list(/datum/reagent/ants = 2, /datum/reagent/consumable/eggyolk = 2)
return list(/datum/reagent/ants = 4, /datum/reagent/consumable/eggyolk = 4)
/obj/item/coin/iron/grind_results()
return list(/datum/reagent/iron = 4)
/obj/item/coin/iron
custom_materials = list(/datum/material/iron = COIN_MATERIAL_AMOUNT)
/obj/item/coin/gold/debug
custom_materials = list(/datum/material/gold = COIN_MATERIAL_AMOUNT)
desc = "If you got this somehow, be aware that it will dust you. Almost certainly."
/obj/item/coin/gold/debug/grind_results()
return list(/datum/reagent/gold/cursed = 4)
return list(/datum/reagent/gold/cursed = 8)
/obj/item/coin/gold/debug/attack_self(mob/user)
if(cooldown < world.time)