Materials Repath (#22388)

Soft-ish port of https://github.com/NebulaSS13/Nebula/pull/540. Except
we call them singletons.

Repaths all materials as singletons instead of datums, and replaces
material defines from strings to paths so that we can just run
GET_SINGLETON instead of needing to use SSMaterials. This is Step One.

This PR has no player-facing changes.

changes:
  - refactor: "Repaths /material to /singleton/material."
- refactor: "Replaces all material string defines to path defines,
replacing SSmaterials procs w/ GET_SINGLETON instead."
- refactor: "Removes all material var edited objects from all maps,
adding new presets where necessary."
- refactor: "Updates recipes unit test to run all recipes against all
material singletons."

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
Co-authored-by: kano-dot <bhutanlikanoxy@gmail.com>
This commit is contained in:
Batrachophreno
2026-07-10 18:45:58 +00:00
committed by GitHub
co-authored by kano-dot
parent 2e61d8fd15
commit eebb8b971c
83 changed files with 696 additions and 782 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
/obj/structure/easel/Initialize(ml, _mat, _reinf_mat)
. = ..()
RegisterSignal(src, COMSIG_MOVABLE_MOVED, PROC_REF(move_painting))
material = SSmaterials.get_material_by_name(MATERIAL_WOOD)
material = GET_SINGLETON(MATERIAL_WOOD)
/obj/structure/easel/Destroy()
painting = null
@@ -18,7 +18,7 @@
var/created_window = /obj/structure/window/basic
var/is_reinforced = 0
var/list/construction_options = list("One Direction", "Full Window")
default_type = "glass"
default_type = MATERIAL_GLASS
icon_has_variants = TRUE
drop_sound = 'sound/items/drop/glass_sheet.ogg'
pickup_sound = 'sound/items/pickup/glass_sheet.ogg'
@@ -112,7 +112,7 @@
name = "reinforced glass"
singular_name = "reinforced glass sheet"
icon_state = "sheet-rglass"
default_type = "reinforced glass"
default_type = MATERIAL_GLASS_REINFORCED
created_window = /obj/structure/window/reinforced
is_reinforced = 1
construction_options = list("One Direction", "Full Window", "Windoor")
@@ -127,7 +127,7 @@
icon = 'icons/obj/item/stacks/tiles.dmi'
icon_state = "glass_wire"
created_window = null
default_type = "wired glass"
default_type = MATERIAL_GLASS_WIRED
construction_options = list()
icon_has_variants = FALSE
@@ -160,7 +160,7 @@
singular_name = "phoron glass sheet"
icon_state = "sheet-phoronglass"
created_window = /obj/structure/window/borosilicate
default_type = "phoron glass"
default_type = MATERIAL_GLASS_PHORON
icon_has_variants = FALSE
/*
@@ -170,7 +170,7 @@
name = "reinforced phoron glass"
singular_name = "reinforced phoron glass sheet"
icon_state = "sheet-phoronrglass"
default_type = "reinforced phoron glass"
default_type = MATERIAL_GLASS_REINFORCED_PHORON
created_window = /obj/structure/window/borosilicate/reinforced
is_reinforced = 1
icon_has_variants = FALSE
@@ -19,14 +19,14 @@
name = "human skin"
desc = "The by-product of human farming."
singular_name = "human skin piece"
default_type = "human hide"
default_type = MATERIAL_HIDE_HUMAN
/obj/item/stack/material/animalhide/corgi
name = "corgi hide"
desc = "The by-product of corgi farming."
singular_name = "corgi hide piece"
icon_state = "sheet-corgi"
default_type = "corgi hide"
default_type = MATERIAL_HIDE_CORGI
icon_has_variants = FALSE
/obj/item/stack/material/animalhide/cat
@@ -34,7 +34,7 @@
desc = "The by-product of cat farming."
icon_state = "sheet-cat"
singular_name = "cat hide piece"
default_type = "cat hide"
default_type = MATERIAL_HIDE_CAT
icon_has_variants = FALSE
/obj/item/stack/material/animalhide/monkey
@@ -42,7 +42,7 @@
desc = "The by-product of monkey farming."
singular_name = "monkey hide piece"
icon_state = "sheet-monkey"
default_type = "monkey hide"
default_type = MATERIAL_HIDE_MONKEY
icon_has_variants = FALSE
/obj/item/stack/material/animalhide/lizard
@@ -50,7 +50,7 @@
desc = "Sssssss..."
singular_name = "lizard skin piece"
icon_state = "sheet-lizard"
default_type = "lizard hide"
default_type = MATERIAL_HIDE_LIZARD
icon_has_variants = FALSE
hide_type = "scales"
@@ -59,7 +59,7 @@
desc = "A hide without fur or scales. Can be tanned into leather."
singular_name = "bare hide piece"
icon_state = "sheet-hairlesshide"
default_type = "bare hide"
default_type = MATERIAL_HIDE_BARE
bare = TRUE
/obj/item/stack/material/animalhide/barehide/mechanics_hints(mob/user, distance, is_adjacent)
@@ -71,7 +71,7 @@
desc = "This leather has been cleaned but still needs to be dried."
singular_name = "wet leather piece"
icon_state = "sheet-wetleather"
default_type = "wet leather"
default_type = MATERIAL_WET_LEATHER
icon_has_variants = TRUE
bare = TRUE
var/wetness = 30 //Reduced when exposed to high temperautres or manually dried with a welding tool.
@@ -10,7 +10,7 @@
/obj/item/material/butterflyconstruction/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER)
to_chat(user, "You finish the concealed blade weapon.")
new /obj/item/material/knife/butterfly(user.loc, material.name)
new /obj/item/material/knife/butterfly(user.loc, material.type)
qdel(src)
return
@@ -36,7 +36,7 @@
if(istype(attacking_item, /obj/item/material/butterflyblade))
var/obj/item/material/butterflyblade/B = attacking_item
to_chat(user, "You attach the two concealed blade parts.")
var/finished = new /obj/item/material/butterflyconstruction(user.loc, B.material.name)
var/finished = new /obj/item/material/butterflyconstruction(user.loc, B.material.type)
qdel(attacking_item)
qdel(src)
user.put_in_hands(finished)
@@ -72,7 +72,7 @@
var/obj/item/finished
if(istype(attacking_item, /obj/item/material/shard) || istype(attacking_item, /obj/item/material/spearhead))
var/obj/item/material/tmp_shard = attacking_item
finished = new /obj/item/material/twohanded/spear(get_turf(user), tmp_shard.material.name)
finished = new /obj/item/material/twohanded/spear(get_turf(user), tmp_shard.material.type)
to_chat(user, SPAN_NOTICE("You fasten \the [attacking_item] to the top of the rod with the cable."))
else if(attacking_item.tool_behaviour == TOOL_WIRECUTTER)
finished = new /obj/item/melee/baton/cattleprod(get_turf(user), forward_cable_color)
@@ -101,14 +101,14 @@
attack_verb = list("hit", "bludgeoned", "whacked", "bonked")
force_divisor = 0.1
thrown_force_divisor = 0.1
default_material = "wood"
default_material = MATERIAL_WOOD
/obj/item/material/shaft/attackby(obj/item/attacking_item, mob/user)
..()
var/obj/item/finished
if(istype(attacking_item, /obj/item/material/spearhead))
var/obj/item/material/spearhead/tip = attacking_item
finished = new /obj/item/material/twohanded/pike(get_turf(user), tip.material.name)
finished = new /obj/item/material/twohanded/pike(get_turf(user), tip.material.type)
to_chat(user, SPAN_NOTICE("You attach \the [attacking_item] to the top of \the [src]."))
if(finished)
user.drop_from_inventory(src,finished)
@@ -130,8 +130,7 @@
attack_verb = list("attacked", "poked")
force_divisor = 0.1
thrown_force_divisor = 0.1
default_material = "steel"
default_material = MATERIAL_STEEL
/obj/item/material/woodenshield
name = "shield donut"
@@ -140,14 +139,14 @@
icon_state = "shield_fitting_inner"
force_divisor = 0.1
thrown_force_divisor = 0.1
default_material = "wood"
default_material = MATERIAL_WOOD
/obj/item/material/woodenshield/attackby(obj/item/attacking_item, mob/user)
..()
var/obj/item/finished
if(istype(attacking_item, /obj/item/material/shieldbits))
var/obj/item/material/woodenshield/donut = attacking_item
finished = new /obj/item/shield/buckler(get_turf(user), donut.material.name)
finished = new /obj/item/shield/buckler(get_turf(user), donut.material.type)
to_chat(user, SPAN_NOTICE("You attach \the [attacking_item] to \the [src]."))
if(finished)
user.drop_from_inventory(src)
@@ -164,7 +163,7 @@
icon_state = "shield_fitting_outer"
force_divisor = 0.1
thrown_force_divisor = 0.1
default_material = "steel"
default_material = MATERIAL_STEEL
/obj/item/woodcirclet
name = "wood circlet"
@@ -20,7 +20,7 @@
/obj/item/material/ashtray/persistent_objects_get_content()
var/list/content = list()
content["fill_count"] = length(contents)
content["material"] = material.name
content["material"] = material.type
return content
/obj/item/material/ashtray/persistent_objects_apply_content(content, x, y, z)
@@ -6,7 +6,7 @@
item_state = "metalbat"
throwforce = 7
attack_verb = list("smashed", "beaten", "slammed", "smacked", "struck", "battered", "bonked")
default_material = "wood"
default_material = MATERIAL_WOOD
force_divisor = 1.1 // 22 when wielded with weight 20 (steel)
unwielded_force_divisor = 0.7 // 15 when unwielded based on above.
slot_flags = SLOT_BACK
@@ -224,7 +224,7 @@
icon_state = "rolling_pin"
item_state = "rolling_pin"
attack_verb = list("bashed", "battered", "bludgeoned", "thrashed", "whacked")
default_material = "wood"
default_material = MATERIAL_WOOD
force_divisor = 0.7 // 10 when wielded with weight 15 (wood)
thrown_force_divisor = 1 // as above
use_material_name = TRUE
@@ -22,7 +22,7 @@ Protectiveness | Armor %
/obj/item/clothing/suit/armor/material
name = "armor"
default_material = DEFAULT_WALL_MATERIAL
default_material = MATERIAL_STEEL
/obj/item/clothing/suit/armor/material/makeshift
name = "sheet armor"
@@ -37,10 +37,10 @@ Protectiveness | Armor %
pocket_slots = 1
/obj/item/clothing/suit/armor/material/makeshift/plasteel
default_material = "plasteel"
default_material = MATERIAL_PLASTEEL
/obj/item/clothing/suit/armor/material/makeshift/glass
default_material = "glass"
default_material = MATERIAL_GLASS
/obj/item/material/armor_plating
name = "armor plating"
@@ -75,7 +75,7 @@ Protectiveness | Armor %
to_chat(user, SPAN_WARNING("Both plates need to be the same type of material."))
return
//TODO: Possible better animations
var/obj/item/clothing/suit/armor/material/makeshift/new_armor = new(src.loc, src.material.name)
var/obj/item/clothing/suit/armor/material/makeshift/new_armor = new(src.loc, src.material)
user.drop_from_inventory(src,new_armor)
user.drop_from_inventory(second_plate,new_armor)
user.put_in_hands(new_armor)
@@ -116,7 +116,7 @@ Protectiveness | Armor %
var/obj/item/stack/material/S = attacking_item
if(S.use(2))
to_chat(user, SPAN_NOTICE("You apply some [S.material.use_name] to \the [src]. "))
var/obj/item/clothing/head/helmet/material/makeshift/helmet = new(null, S.material.name)
var/obj/item/clothing/head/helmet/material/makeshift/helmet = new(null, S.material.type)
user.put_in_hands(helmet)
user.drop_from_inventory(src)
qdel(src)
@@ -129,7 +129,7 @@ Protectiveness | Armor %
/obj/item/clothing/head/helmet/material
name = "helmet"
flags_inv = HIDEEARS|HIDEEYES|BLOCKHAIR
default_material = DEFAULT_WALL_MATERIAL
default_material = MATERIAL_STEEL
has_storage = FALSE
/obj/item/clothing/head/helmet/material/makeshift
@@ -141,7 +141,7 @@ Protectiveness | Armor %
contained_sprite = 1
/obj/item/clothing/head/helmet/material/makeshift/plasteel
default_material = "plasteel"
default_material = MATERIAL_PLASTEEL
/obj/item/clothing/suit/armor/material/makeshift/trenchcoat
name = "armored trenchcoat"
@@ -156,7 +156,7 @@ Protectiveness | Armor %
var/obj/item/clothing/suit/storage/toggle/trench/kelly = attacking_item
user.drop_from_inventory(src)
user.drop_from_inventory(kelly)
var/obj/item/clothing/suit/armor/material/makeshift/trenchcoat/new_armor = new(null, src.material.name)
var/obj/item/clothing/suit/armor/material/makeshift/trenchcoat/new_armor = new(null, src.material.type)
user.put_in_hands(new_armor)
qdel(src)
qdel(kelly)
@@ -20,8 +20,8 @@
var/max_force = 40 //any damage above this is added to armor penetration value
var/max_pen = 100 //any penetration above this value is ignored
var/thrown_force_divisor = 0.5
var/default_material = DEFAULT_WALL_MATERIAL
var/material/material
var/default_material = MATERIAL_STEEL
var/singleton/material/material
var/drops_debris = TRUE
/// Multiplies the amount this item is worth with the following calculation: material.value * worth_multiplier
@@ -59,7 +59,7 @@
throwforce = round(material.get_blunt_damage()*thrown_force_divisor)
/obj/item/material/proc/set_material(var/new_material)
material = SSmaterials.get_material_by_name(new_material)
material = GET_SINGLETON(new_material)
if(!material)
qdel(src)
else
@@ -14,7 +14,7 @@
thrown_force_divisor = 0.4 // 4 with weight 15 (glass)
item_state = "shard-glass"
attack_verb = list("stabbed", "slashed", "sliced", "cut")
default_material = "glass"
default_material = MATERIAL_GLASS
unbreakable = 1 //It's already broken.
drops_debris = FALSE
drop_sound = 'sound/effects/glass_step.ogg'
@@ -196,7 +196,7 @@
/obj/item/material/sword_hilt/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/material/sword_blade))
var/obj/item/material/sword_blade/blade = attacking_item
var/obj/item/material/sword/improvised_sword/new_sword = new(src.loc, blade.material.name)
var/obj/item/material/sword/improvised_sword/new_sword = new(src.loc, blade.material.type)
new_sword.hilt = src
user.drop_from_inventory(src,new_sword)
user.drop_from_inventory(blade,new_sword)
@@ -219,7 +219,7 @@
/obj/item/material/sword_blade/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/material/sword_hilt))
var/obj/item/material/sword_hilt/hilt = attacking_item
var/obj/item/material/sword/improvised_sword/new_sword = new(src.loc, src.material.name)
var/obj/item/material/sword/improvised_sword/new_sword = new(src.loc, src.material.type)
new_sword.hilt = hilt.material
new_sword.assignDescription()
user.drop_from_inventory(src,new_sword)
@@ -172,7 +172,7 @@
w_class = WEIGHT_CLASS_HUGE
icon_state = "offhand"
name = "offhand"
default_material = "placeholder"
default_material = MATERIAL_STEEL
drop_sound = null
pickup_sound = null
equip_sound = null
@@ -258,7 +258,7 @@
sharp = 0
mob_throw_hit_sound = 'sound/weapons/pierce.ogg'
attack_verb = list("attacked", "poked", "jabbed", "torn", "gored")
default_material = "glass"
default_material = MATERIAL_GLASS
var/obj/item/grenade/explosive = null
use_material_sound = FALSE
worth_multiplier = 7 //blade + stuff
@@ -290,7 +290,7 @@
MA.layer = FLOAT_LAYER
HS.AddOverlays(MA)
HS.name = "[attacking_item.name] on a spear"
HS.material = material.name
HS.material = material.type
qdel(src)
return
@@ -374,7 +374,7 @@
attack_verb = list("chopped", "sliced", "shredded", "slashed", "cut", "ripped")
can_embed = FALSE
applies_material_colour = FALSE
default_material = "steel"
default_material = MATERIAL_STEEL
parry_chance = 5
var/fuel_type = /singleton/reagent/fuel
var/opendelay = 30 // How long it takes to perform a door opening action with this chainsaw, in seconds.
@@ -418,7 +418,7 @@
fuel_cost = 0.5
unbreakable = TRUE
parry_chance = 100 //Gotta punish those validhunters
default_material = "plasteel"
default_material = MATERIAL_PLASTEEL
/obj/item/material/twohanded/chainsaw/op/Initialize()
. = ..()
@@ -560,7 +560,7 @@
w_class = WEIGHT_CLASS_BULKY
slot_flags = SLOT_BACK
attack_verb = list("attacked", "poked", "jabbed", "gored", "stabbed")
default_material = "steel"
default_material = MATERIAL_STEEL
reach = 2
applies_material_colour = 0
can_embed = 0
@@ -599,7 +599,7 @@
desc = "For the republic!"
icon_state = "flag_biesel0"
base_icon = "flag_biesel"
default_material = "bronze"
default_material = MATERIAL_STEEL
can_embed = 1
use_material_name = FALSE
unbreakable = TRUE
@@ -665,7 +665,7 @@
edge = TRUE
sharp = 1
attack_verb = list("attacked", "chopped", "cleaved", "torn", "cut")
default_material = "steel"
default_material = MATERIAL_STEEL
parry_chance = 60
can_embed = 0
worth_multiplier = 35