Files
GhomandGitHub 0b0c5ea91e Unit test material checks are now performed on all crafting recipes by default. All stack recipes now transfer mats to the results (#92620)
## About The Pull Request
Extends the part of the crafting unit test that ensures consistency
between the total mats of the components of a recipe (or rather, the
result of said recipe) and a generic instance of the same type as its
result, previously only implemented on food recipes.

## Why It's Good For The Game
This ensures a degree of consistency with the material composition of
various objects in the game. I couldn't do it in the original PR as that
one was too big already and it took months to get it merged, and have
the relative bugs fixed.

Currently a WIP as I slowly deal with the unit test reports.

## Changelog

🆑
refactor: Follow-up to the crafting/material refactor from months ago.
All objects crafted with stacks now inherit their mat composition (not
necessarily the effects and color) by default, while previously only a
few things like chair, sinks and toilets did. Report any object looking
or behaving weirdly as a result.
fix: The material composition of ammo boxes is no longer a 1/10 of what
it's supposed to be. It was a shitty hack to make it harder to recycle
empty ammo boxes. Instead, they lose materials as they're emptied now.
/🆑
2025-12-02 18:29:01 -05:00

234 lines
9.2 KiB
Plaintext

/obj/item/stack/tile/mineral
/// Determines what stack is gotten out of us when welded.
var/mineralType = null
/obj/item/stack/tile/mineral/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers)
if(W.tool_behaviour == TOOL_WELDER)
if(get_amount() < 4)
to_chat(user, span_warning("You need at least four tiles to do this!"))
return
if(!mineralType)
to_chat(user, span_warning("You can not reform this!"))
stack_trace("A mineral tile of type [type] doesn't have its mineralType set.")
return
if(W.use_tool(src, user, 0, volume=40))
var/sheet_type = text2path("/obj/item/stack/sheet/mineral/[mineralType]")
var/obj/item/stack/sheet/mineral/new_item = new sheet_type(user.loc)
user.visible_message(span_notice("[user] shaped [src] into [new_item] with [W]."), \
span_notice("You shaped [src] into [new_item] with [W]."), \
span_hear("You hear welding."))
var/holding = user.is_holding(src)
use(4)
if(holding && QDELETED(src))
user.put_in_hands(new_item)
else
return ..()
/obj/item/stack/tile/mineral/plasma
name = "plasma tile"
singular_name = "plasma floor tile"
desc = "A tile made out of highly flammable plasma. This can only end well."
icon_state = "tile_plasma"
inhand_icon_state = "tile-plasma"
turf_type = /turf/open/floor/mineral/plasma
mineralType = "plasma"
mats_per_unit = list(/datum/material/plasma=SHEET_MATERIAL_AMOUNT*0.25)
merge_type = /obj/item/stack/tile/mineral/plasma
/obj/item/stack/tile/mineral/uranium
name = "uranium tile"
singular_name = "uranium floor tile"
desc = "A tile made out of uranium. You feel a bit woozy."
icon_state = "tile_uranium"
inhand_icon_state = "tile-uranium"
turf_type = /turf/open/floor/mineral/uranium
mineralType = "uranium"
mats_per_unit = list(/datum/material/uranium=SHEET_MATERIAL_AMOUNT*0.25)
merge_type = /obj/item/stack/tile/mineral/uranium
/obj/item/stack/tile/mineral/gold
name = "gold tile"
singular_name = "gold floor tile"
desc = "A tile made out of gold, the swag seems strong here."
icon_state = "tile_gold"
inhand_icon_state = "tile-gold"
turf_type = /turf/open/floor/mineral/gold
mineralType = "gold"
mats_per_unit = list(/datum/material/gold=SHEET_MATERIAL_AMOUNT*0.25)
merge_type = /obj/item/stack/tile/mineral/gold
/obj/item/stack/tile/mineral/silver
name = "silver tile"
singular_name = "silver floor tile"
desc = "A tile made out of silver, the light shining from it is blinding."
icon_state = "tile_silver"
inhand_icon_state = "tile-silver"
turf_type = /turf/open/floor/mineral/silver
mineralType = "silver"
mats_per_unit = list(/datum/material/silver=SHEET_MATERIAL_AMOUNT*0.25)
merge_type = /obj/item/stack/tile/mineral/silver
/obj/item/stack/tile/mineral/diamond
name = "diamond tile"
singular_name = "diamond floor tile"
desc = "A tile made out of diamond. Wow, just, wow."
icon_state = "tile_diamond"
inhand_icon_state = "tile-diamond"
turf_type = /turf/open/floor/mineral/diamond
mineralType = "diamond"
mats_per_unit = list(/datum/material/diamond=SHEET_MATERIAL_AMOUNT*0.25)
merge_type = /obj/item/stack/tile/mineral/diamond
/obj/item/stack/tile/mineral/bananium
name = "bananium tile"
singular_name = "bananium floor tile"
desc = "A non-slippery tile made out of bananium, HOOOOOOOOONK!"
icon_state = "tile_bananium"
inhand_icon_state = "tile-bananium"
turf_type = /turf/open/floor/mineral/bananium
mineralType = "bananium"
mats_per_unit = list(/datum/material/bananium=SHEET_MATERIAL_AMOUNT*0.25)
material_flags = NONE //The slippery comp makes it unpractical for good clown decor. The material tiles should still slip.
merge_type = /obj/item/stack/tile/mineral/bananium
/obj/item/stack/tile/mineral/abductor
name = "alien floor tile"
singular_name = "alien floor tile"
desc = "A tile made out of alien alloy."
icon = 'icons/obj/antags/abductor.dmi'
icon_state = "tile_abductor"
inhand_icon_state = "tile-abductor"
mats_per_unit = list(/datum/material/alloy/alien=SHEET_MATERIAL_AMOUNT*0.25)
turf_type = /turf/open/floor/mineral/abductor
mineralType = "abductor"
merge_type = /obj/item/stack/tile/mineral/abductor
/obj/item/stack/tile/mineral/titanium
name = "titanium tile"
singular_name = "titanium floor tile"
desc = "Sleek titanium tiles, used for shuttles."
icon_state = "tile_titanium"
inhand_icon_state = "tile-shuttle"
turf_type = /turf/open/floor/mineral/titanium
mineralType = "titanium"
mats_per_unit = list(/datum/material/titanium=SHEET_MATERIAL_AMOUNT*0.25)
merge_type = /obj/item/stack/tile/mineral/titanium
tile_reskin_types = list(
/obj/item/stack/tile/mineral/titanium,
/obj/item/stack/tile/mineral/titanium/yellow,
/obj/item/stack/tile/mineral/titanium/blue,
/obj/item/stack/tile/mineral/titanium/white,
/obj/item/stack/tile/mineral/titanium/purple,
/obj/item/stack/tile/mineral/titanium/tiled,
/obj/item/stack/tile/mineral/titanium/tiled/yellow,
/obj/item/stack/tile/mineral/titanium/tiled/blue,
/obj/item/stack/tile/mineral/titanium/tiled/white,
/obj/item/stack/tile/mineral/titanium/tiled/purple,
)
/obj/item/stack/tile/mineral/titanium/yellow
name = "yellow titanium tile"
singular_name = "yellow titanium floor tile"
desc = "Sleek yellow titanium tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/yellow
icon_state = "tile_titanium_yellow"
merge_type = /obj/item/stack/tile/mineral/titanium/yellow
/obj/item/stack/tile/mineral/titanium/blue
name = "blue titanium tile"
singular_name = "blue titanium floor tile"
desc = "Sleek blue titanium tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/blue
icon_state = "tile_titanium_blue"
merge_type = /obj/item/stack/tile/mineral/titanium/blue
/obj/item/stack/tile/mineral/titanium/white
name = "white titanium tile"
singular_name = "white titanium floor tile"
desc = "Sleek white titanium tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/white
icon_state = "tile_titanium_white"
merge_type = /obj/item/stack/tile/mineral/titanium/white
/obj/item/stack/tile/mineral/titanium/purple
name = "purple titanium tile"
singular_name = "purple titanium floor tile"
desc = "Sleek purple titanium tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/purple
icon_state = "tile_titanium_purple"
merge_type = /obj/item/stack/tile/mineral/titanium/purple
/obj/item/stack/tile/mineral/titanium/tiled
name = "tiled titanium tile"
singular_name = "tiled titanium floor tile"
desc = "Titanium floor tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/tiled
icon_state = "tile_titanium_tiled"
merge_type = /obj/item/stack/tile/mineral/titanium/tiled
/obj/item/stack/tile/mineral/titanium/tiled/yellow
name = "yellow titanium tile"
singular_name = "yellow titanium floor tile"
desc = "Yellow titanium floor tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/tiled/yellow
icon_state = "tile_titanium_tiled_yellow"
merge_type = /obj/item/stack/tile/mineral/titanium/tiled/yellow
/obj/item/stack/tile/mineral/titanium/tiled/blue
name = "blue titanium tile"
singular_name = "blue titanium floor tile"
desc = "Blue titanium floor tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/tiled/blue
icon_state = "tile_titanium_tiled_blue"
merge_type = /obj/item/stack/tile/mineral/titanium/tiled/blue
/obj/item/stack/tile/mineral/titanium/tiled/white
name = "white titanium tile"
singular_name = "white titanium floor tile"
desc = "White titanium floor tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/tiled/white
icon_state = "tile_titanium_tiled_white"
merge_type = /obj/item/stack/tile/mineral/titanium/tiled/white
/obj/item/stack/tile/mineral/titanium/tiled/purple
name = "purple titanium tile"
singular_name = "purple titanium floor tile"
desc = "Purple titanium floor tiles, used for shuttles."
turf_type = /turf/open/floor/mineral/titanium/tiled/purple
icon_state = "tile_titanium_tiled_purple"
merge_type = /obj/item/stack/tile/mineral/titanium/tiled/purple
/obj/item/stack/tile/mineral/plastitanium
name = "plastitanium tile"
singular_name = "plastitanium floor tile"
desc = "A tile made of plastitanium, used for very evil shuttles."
icon_state = "tile_plastitanium"
inhand_icon_state = "tile-darkshuttle"
turf_type = /turf/open/floor/mineral/plastitanium
mineralType = "plastitanium"
mats_per_unit = list(/datum/material/alloy/plastitanium=SHEET_MATERIAL_AMOUNT*0.25)
merge_type = /obj/item/stack/tile/mineral/plastitanium
tile_reskin_types = list(
/obj/item/stack/tile/mineral/plastitanium,
/obj/item/stack/tile/mineral/plastitanium/red,
)
/obj/item/stack/tile/mineral/plastitanium/red
name = "red plastitanium tile"
singular_name = "red plastitanium floor tile"
desc = "A tile made of plastitanium, used for very red shuttles."
turf_type = /turf/open/floor/mineral/plastitanium/red
icon_state = "tile_plastitanium_red"
merge_type = /obj/item/stack/tile/mineral/plastitanium/red
/obj/item/stack/tile/mineral/snow
name = "snow tile"
singular_name = "snow tile"
desc = "A layer of snow."
icon_state = "tile_snow"
inhand_icon_state = "tile-silver"
turf_type = /turf/open/floor/fake_snow
mineralType = "snow"
merge_type = /obj/item/stack/tile/mineral/snow
mats_per_unit = list(/datum/material/snow = HALF_SHEET_MATERIAL_AMOUNT / 2)