Fix for material tiles and walls not having material when constructed from last item in the stack (#96404)

## About The Pull Request

Fixes #96244.
Problem was that when you use last item in the stack, the stack gets
qdel'd and the destructor is called. The destructor sets `mats_per_unit
= null` for the object, and when custom materials applied to tile/wall
it is null.
Bug was caused by #92620. I'm not gonna review 272 files from that PR to
see if I can delete that destructor, potentially breaking something
else, so this is a lazy fix for the annoying bug which is 6 months old.

## Changelog
🆑
fix: fixed material tiles and walls not having material when constructed
from last item in the stack
/🆑
This commit is contained in:
antropod
2026-06-12 01:04:50 +02:00
committed by GitHub
parent 8ef4eb31bc
commit 4a72162d07
2 changed files with 6 additions and 2 deletions
@@ -1162,9 +1162,11 @@
merge_type = /obj/item/stack/tile/material
/obj/item/stack/tile/material/place_tile(turf/open/target_plating, mob/user)
// Save refernce to the materials for the case when we place last tile in the stack
var/list/saved_mats_per_unit = mats_per_unit
. = ..()
var/turf/open/floor/material/floor = .
floor?.set_custom_materials(mats_per_unit)
floor?.set_custom_materials(saved_mats_per_unit)
/obj/item/stack/tile/eighties
name = "retro tile"