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
+4 -4
View File
@@ -3,15 +3,15 @@
desc = "A wall that had a hole burnt into it. Nasty."
icon = 'icons/turf/flooring/plating.dmi'
icon_state = "wall_thermite"
var/material/material
var/material/reinf_material
var/singleton/material/material
var/singleton/material/reinf_material
/obj/effect/overlay/burnt_wall/Initialize(mapload, new_name, new_mat, new_reinf_mat)
. = ..()
name = "burnt [new_name]"
material = SSmaterials.get_material_by_name(new_mat)
material = GET_SINGLETON(new_mat)
if(new_reinf_mat)
reinf_material = SSmaterials.get_material_by_name(new_reinf_mat)
reinf_material = GET_SINGLETON(new_reinf_mat)
color = material.icon_colour
if(material.opacity < 0.5)
alpha = 125
+1 -1
View File
@@ -208,7 +208,7 @@
to_chat(user, SPAN_NOTICE("There isn't enough material here to construct a wall."))
return TRUE
var/material/M = SSmaterials.get_material_by_name(S.default_type)
var/singleton/material/M = GET_SINGLETON(S.default_type)
if(!istype(M))
return TRUE
if(M.integrity < 50)
+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
+4 -5
View File
@@ -14,17 +14,16 @@
/// Footstep sounds when stepped on
var/list/footstep_sound
var/material/material
var/singleton/material/material
/// Used by some structures to determine into how many pieces they should disassemble into or be made with
var/build_amt = 2
/// Amount that pulling mobs have their movement delayed by
var/slowdown = 0
/obj/structure/Initialize(mapload)
. = ..()
if(!isnull(material) && !istype(material))
material = SSmaterials.get_material_by_name(material)
material = GET_SINGLETON(material)
if (!mapload)
updateVisibility(src) // No point checking this before visualnet initializes.
if(climbable)
@@ -101,9 +100,9 @@
add_damage(maxhealth * 0.25)
/obj/structure/proc/dismantle()
var/material/dismantle_material
var/singleton/material/dismantle_material
if(!get_material())
dismantle_material = SSmaterials.get_material_by_name(DEFAULT_WALL_MATERIAL) //if there is no defined material, it will use steel
dismantle_material = GET_SINGLETON(MATERIAL_STEEL)
else
dismantle_material = get_material()
if(should_use_health && health <= 0)
+13 -13
View File
@@ -117,19 +117,19 @@ Class Procs:
var/power_init_complete = FALSE
/// What power channel does this fall under in APCs? Possible channels include: AREA_USAGE_EQUIP, AREA_USAGE_ENVIRON or AREA_USAGE_LIGHT
var/power_channel = AREA_USAGE_EQUIP
/* List of types that should be spawned as component_parts for this machine.
Structure:
type -> num_objects
num_objects is optional, and will be treated as 1 if omitted.
example:
component_types = list(
/obj/foo/bar,
/obj/baz = 2
)
*/
/**
* List of types that should be spawned as component_parts for this machine.
* Structure:
* type -> num_objects
*
* num_objects is optional, and will be treated as 1 if omitted.
*
* example:
* component_types = list(
* /obj/foo/bar,
* /obj/baz = 2
* )
**/
var/list/component_types
/// List of all the parts used to build it, if made from certain kinds of frames.
var/list/component_parts = null
+2 -2
View File
@@ -102,7 +102,7 @@ GLOBAL_LIST_EMPTY(total_active_bonfires)
return
else if(istype(attacking_item, /obj/item/material))
var/obj/item/material/M = attacking_item
if(M.material.name in burnable_materials)
if(M.material.type in burnable_materials)
var/fuel_add = burnable_materials[M.material] * (M.w_class / 5) //if you crafted a small item, it's not worth as much fuel
fuel = min(fuel + fuel_add, max_fuel)
user.visible_message(SPAN_NOTICE("\The [user] tosses \the [M] into \the [src]."))
@@ -359,7 +359,7 @@ GLOBAL_LIST_EMPTY(total_active_bonfires)
fuel = 0 //don't start with fuel
if(!material_name)
material_name = MATERIAL_MARBLE
material = SSmaterials.get_material_by_name(material_name)
material = GET_SINGLETON(material_name)
if(!material)
qdel(src)
return
+1 -1
View File
@@ -6,7 +6,7 @@ ABSTRACT_TYPE(/obj/structure/cart)
density = TRUE
climbable = TRUE
build_amt = 15
material = DEFAULT_WALL_MATERIAL
material = MATERIAL_STEEL
slowdown = 0
atom_flags = CRITICAL_ATOM
var/movesound = 'sound/effects/roll.ogg'
+1 -1
View File
@@ -12,7 +12,7 @@
/obj/structure/curtain/Initialize()
. = ..()
material = SSmaterials.get_material_by_name(curtain_material)
material = GET_SINGLETON(curtain_material)
AddComponent(/datum/component/turf_hand)
/obj/structure/curtain/open
@@ -7,7 +7,7 @@
anchored = TRUE
opacity = TRUE
climbable = TRUE
material = DEFAULT_WALL_MATERIAL
material = MATERIAL_STEEL
/obj/structure/fluff/evidenceshelf/attackby(obj/item/attacking_item, mob/user)
+3 -3
View File
@@ -12,7 +12,7 @@
/// How much cover the girder provides against projectiles.
var/cover = 50
build_amt = 2
var/material/reinf_material
var/singleton/material/reinf_material
var/reinforcing = 0
var/plating = FALSE
@@ -232,7 +232,7 @@
to_chat(user, SPAN_NOTICE("There isn't enough material here to construct a wall."))
return 0
var/material/material = SSmaterials.get_material_by_name(mat_stack.default_type)
var/singleton/material/material = GET_SINGLETON(mat_stack.default_type)
if(!istype(material))
return 0
@@ -282,7 +282,7 @@
to_chat(user, SPAN_NOTICE("There isn't enough material here to reinforce the girder."))
return 0
var/material/material = SSmaterials.get_material_by_name(mat_stack.default_type)
var/singleton/material/material = GET_SINGLETON(mat_stack.default_type)
if(!istype(material) || material.integrity < 50)
to_chat(user, "You cannot reinforce \the [src] with that; it is too soft.")
return 0
@@ -31,7 +31,7 @@ Deployable Kits
/obj/structure/blocker/proc/set_material(var/material_name)
if(force_material)
material_name = force_material
material = SSmaterials.get_material_by_name(material_name)
material = GET_SINGLETON(material_name)
if(!material)
qdel(src)
return
@@ -54,8 +54,6 @@
var/obj/structure/machinery/door/airlock/close_other
/// The ID of the connected door to close.
var/close_other_id
/// String (One of `MATERIAL_*`). The material the door is made from. If not set, defaults to steel.
var/mineral
/// Boolean. Whether or not the door's safeties are enabled. Tied to the safety wire.
var/safe = TRUE
/// Airlock electronics.
@@ -127,7 +125,7 @@
/// String (One of `MATERIAL_*`). The material used for the door's window if `glass` is set. Used to set `window_material` during init.
var/init_material_window = MATERIAL_GLASS
/// The material of the door's window.
var/material/window_material
var/singleton/material/window_material
hashatch = TRUE
@@ -243,7 +241,7 @@
if (glass)
paintable |= AIRLOCK_PAINTABLE_WINDOW
window_material = SSmaterials.get_material_by_name(init_material_window)
window_material = GET_SINGLETON(init_material_window)
opacity = FALSE
update_icon()
@@ -284,9 +282,9 @@
..()
/obj/structure/machinery/door/airlock/get_material()
if(mineral)
return SSmaterials.get_material_by_name(mineral)
return SSmaterials.get_material_by_name(DEFAULT_WALL_MATERIAL)
if(material)
return GET_SINGLETON(material)
return GET_SINGLETON(MATERIAL_STEEL)
/obj/structure/machinery/door/airlock/external//External airlocks start here
name = "external airlock"
@@ -718,23 +716,23 @@
/obj/structure/machinery/door/airlock/gold
name = "Gold Airlock"
door_color = COLOR_GOLD
mineral = "gold"
material = MATERIAL_GOLD
/obj/structure/machinery/door/airlock/silver
name = "Silver Airlock"
door_color = COLOR_SILVER
mineral = "silver"
material = MATERIAL_SILVER
/obj/structure/machinery/door/airlock/diamond
name = "Diamond Airlock"
door_color = COLOR_DIAMOND
mineral = "diamond"
material = MATERIAL_DIAMOND
maxhealth = OBJECT_HEALTH_EXTREMELY_HIGH
/obj/structure/machinery/door/airlock/sandstone
name = "Sandstone Airlock"
door_color = COLOR_BEIGE
mineral = "sandstone"
material = MATERIAL_SANDSTONE
/obj/structure/machinery/door/airlock/palepurple
door_color = COLOR_PURPLE
@@ -784,6 +782,7 @@
MELEE = ARMOR_MELEE_MINOR,
BULLET = ARMOR_BALLISTIC_MINOR
)
material = MATERIAL_DIONA
/// Placeholder object until it gets new sprites.
/obj/structure/machinery/door/airlock/diona/external
@@ -794,7 +793,7 @@
name = "Uranium Airlock"
desc = "And they said I was crazy."
door_color = COLOR_GREEN
mineral = "uranium"
material = MATERIAL_URANIUM
var/last_event = 0
/obj/structure/machinery/door/airlock/uranium/process()
@@ -809,7 +808,7 @@
name = "Phoron Airlock"
desc = "No way this can end badly."
door_color = COLOR_VIOLET
mineral = MATERIAL_PHORON
material = MATERIAL_PHORON
/obj/structure/machinery/door/airlock/phoron/fire_act(exposed_temperature, exposed_volume)
. = ..()
@@ -1719,8 +1718,8 @@ About the new airlock wires panel:
da.set_dir(src.dir)
da.anchored = 1
if(mineral)
da.glass = mineral
if(material)
da.glass = material
else if(glass && !da.glass)
da.glass = 1
da.state = 1
@@ -204,7 +204,7 @@
..()
/obj/structure/machinery/door/firedoor/get_material()
return SSmaterials.get_material_by_name(DEFAULT_WALL_MATERIAL)
return GET_SINGLETON(DEFAULT_WALL_MATERIAL)
/obj/structure/machinery/door/firedoor/CollidedWith(atom/bumped_atom)
if(p_open || operating)
@@ -231,7 +231,7 @@
var/obj/item/stack/material/M = attacking_item
if(!M.material)
return ..()
if(!(M.material.name in list(MATERIAL_STEEL, MATERIAL_GLASS, MATERIAL_GOLD, MATERIAL_SILVER, MATERIAL_DIAMOND, MATERIAL_PHORON, MATERIAL_URANIUM, MATERIAL_PLASTEEL, MATERIAL_ALUMINIUM, MATERIAL_LEAD)))
if(!(M.material.type in list(MATERIAL_STEEL, MATERIAL_GLASS, MATERIAL_GOLD, MATERIAL_SILVER, MATERIAL_DIAMOND, MATERIAL_PHORON, MATERIAL_URANIUM, MATERIAL_PLASTEEL, MATERIAL_ALUMINIUM, MATERIAL_LEAD)))
to_chat(user, SPAN_WARNING("\The [src] cannot hold [M.material.name]."))
return TRUE
@@ -465,7 +465,7 @@
if(!amount)
return
material = lowertext(material)
var/material/mattype = SSmaterials.get_material_by_name(material)
var/singleton/material/mattype = GET_SINGLETON(material)
var/stack_type = mattype.stack_type
var/real_amount = round(amount / SHEET_MATERIAL_AMOUNT)
+1 -1
View File
@@ -23,7 +23,7 @@
/obj/structure/plasticflaps/Initialize()
. = ..()
material = SSmaterials.get_material_by_name(MATERIAL_PLASTIC)
material = GET_SINGLETON(MATERIAL_PLASTIC)
update_icon()
/obj/structure/plasticflaps/update_icon()
+2 -2
View File
@@ -66,7 +66,7 @@
/obj/structure/railing/mapped/no_density/low
icon_state = "railing0-0"
/obj/structure/railing/New(var/newloc, var/material_key = DEFAULT_WALL_MATERIAL)
/obj/structure/railing/New(var/newloc, var/material_key = MATERIAL_STEEL)
material = material_key // Converted to datum in initialize().
..(newloc)
@@ -81,7 +81,7 @@
if(!non_material_object)
if(!isnull(material) && !istype(material))
material = SSmaterials.get_material_by_name(material)
material = GET_SINGLETON(material)
if(!istype(material))
return INITIALIZE_HINT_QDEL
+4 -4
View File
@@ -30,11 +30,11 @@
health -= material.combustion_effect(get_turf(src),temperature, 0.3)
CheckHealth()
/obj/structure/simple_door/New(var/newloc, var/material_name, var/locked)
/obj/structure/simple_door/New(var/newloc, var/newmaterial, var/locked)
..()
if(!material_name)
material_name = DEFAULT_WALL_MATERIAL
material = SSmaterials.get_material_by_name(material_name)
if(!newmaterial)
newmaterial = MATERIAL_STEEL
material = GET_SINGLETON(newmaterial)
if(!material)
qdel(src)
return
@@ -25,23 +25,27 @@
buckle_lying = 1
build_amt = 2
pass_flags_self = PASSTABLE
var/material/padding_material
var/singleton/material/padding_material
var/base_icon = "bed"
var/buckling_sound = 'sound/effects/buckle.ogg'
var/painted_colour // Used for paint gun and preset colours. I know this name sucks.
/// Used for paint gun and preset colours. I know this name sucks.
var/painted_colour
var/can_dismantle = TRUE
var/can_pad = TRUE
var/makes_rolling_sound = FALSE
var/held_item = null // Set to null if you don't want people to pick this up.
/// Set to null if you don't want people to pick this up.
var/held_item = null
slowdown = 2.5
var/driving = FALSE // Shit for wheelchairs. Doesn't really get used here, but it's for code cleanliness.
/// Shit for wheelchairs. Doesn't really get used here, but it's for code cleanliness.
var/driving = FALSE
var/mob/living/pulling = null
var/propelled = 0 // Check for fire-extinguisher-driven chairs
/// Check for fire-extinguisher-driven chairs
var/propelled = 0
/obj/structure/bed/mechanics_hints()
. = list()
@@ -76,12 +80,12 @@
/obj/structure/bed/New(newloc, new_material = MATERIAL_STEEL, new_padding_material, new_painted_colour)
..(newloc)
material = SSmaterials.get_material_by_name(new_material)
material = GET_SINGLETON(new_material)
if(!istype(material))
qdel(src)
return
if(new_padding_material)
padding_material = SSmaterials.get_material_by_name(new_padding_material)
padding_material = GET_SINGLETON(new_padding_material)
if(new_painted_colour)
painted_colour = new_painted_colour
update_icon()
@@ -104,7 +108,7 @@
generate_overlay_cache(padding_material, CACHE_TYPE_PADDING, apply_painted_colour = TRUE)
/obj/structure/bed/proc/generate_overlay_cache(var/new_material, var/cache_type, var/cache_layer = layer, var/apply_painted_colour = FALSE) // Cache type refers to what cache we're making. Material type refers if we're taking from the padding or the chair material itself.
var/material/overlay_material = new_material
var/singleton/material/overlay_material = new_material
var/list/furniture_cache = SSicon_cache.furniture_cache
var/cache_key = "[base_icon]-[overlay_material.name]" // Basically, generates a cache key for an overlay.
if(cache_type)
@@ -180,7 +184,7 @@
else if(istype(attacking_item,/obj/item/stack/material))
var/obj/item/stack/material/M = attacking_item
if(M.material && (M.material.flags & MATERIAL_PADDING))
padding_type = "[M.material.name]"
padding_type = M.material.type
if(!padding_type)
to_chat(user, "You cannot pad \the [src] with that.")
return
@@ -249,8 +253,8 @@
generate_strings(TRUE)
update_icon()
/obj/structure/bed/proc/add_padding(padding_type)
padding_material = SSmaterials.get_material_by_name(padding_type)
/obj/structure/bed/proc/add_padding(var/padding_type)
padding_material = GET_SINGLETON(padding_type)
generate_strings(TRUE)
update_icon()
@@ -21,7 +21,7 @@
if(!held_item || use_check_and_message(user) || buckled || (anchored && padding_material)) // Make sure held_item = null if you don't want it to get picked up.
return
user.visible_message(SPAN_NOTICE("[user] [withdraw_verb]s \the [src.name]."), SPAN_NOTICE("You [withdraw_verb] \the [src.name]."))
var/obj/item/material/stool/S = new held_item(src.loc, material.name, padding_material?.name, painted_colour) // Handles all the material code so you don't have to.
var/obj/item/material/stool/S = new held_item(src.loc, material.type, padding_material?.type, painted_colour) // Handles all the material code so you don't have to.
if(material_alteration & MATERIAL_ALTERATION_COLOR) // For snowflakes like wood chairs.
S.color = material.icon_colour
if(material_alteration & MATERIAL_ALTERATION_NAME)
@@ -182,7 +182,7 @@
force_divisor = 0.4
w_class = WEIGHT_CLASS_HUGE
contained_sprite = TRUE
var/material/padding_material
var/singleton/material/padding_material
var/obj/structure/bed/stool/origin_type = /obj/structure/bed/stool
var/deploy_verb = "right"
var/painted_colour
@@ -194,7 +194,7 @@
/obj/item/material/stool/New(var/newloc, var/new_material, var/new_padding_material, var/new_painted_colour)
..(newloc, new_material) // new_material handled in material_weapons.dm
if(new_padding_material)
padding_material = SSmaterials.get_material_by_name(new_padding_material)
padding_material = GET_SINGLETON(new_padding_material)
if(new_painted_colour)
painted_colour = new_painted_colour
update_icon()
@@ -242,7 +242,7 @@
user.visible_message(SPAN_NOTICE("[user] [deploy_verb]s \the [src.name]."), SPAN_NOTICE("You [deploy_verb] \the [name]."))
// playsound(src, deploy_sound ? deploy_sound : drop_sound, DROP_SOUND_VOLUME)
user.drop_from_inventory(src)
var/obj/structure/bed/stool/S = new origin_type(get_turf(loc), material?.name, padding_material?.name, painted_colour) // Fuck me.
var/obj/structure/bed/stool/S = new origin_type(get_turf(loc), material?.type, padding_material?.type, painted_colour) // Fuck me.
S.dir = user.dir // Plant it where the user's facing
if(blood_DNA)
S.blood_DNA |= blood_DNA // Transfer blood.
+1 -1
View File
@@ -11,7 +11,7 @@
/obj/structure/target_stake/Initialize(mapload)
. = ..()
material = SSmaterials.get_material_by_name(MATERIAL_STEEL)
material = GET_SINGLETON(MATERIAL_STEEL)
/obj/structure/target_stake/attackby(obj/item/attacking_item, mob/user)
if(istype(attacking_item, /obj/item/target))