Files
SkyratBot 806f038524 [MIRROR] Refactors how machines are deconstructed (#26466)
* Refactors how machines are deconstructed (#81291)

## About The Pull Request
This refactors how machines are deconstructed in the following ways

- You can no longer override `obj/machinery/deconstruct()`. If you want
customized behaviour then override `on_deconstruction()` instead.

This comes with the added benifit of no longer needing to check for the
`NO_DECONSTRUCTION` flag because the machine base proc does that for us
& if it finds that flag it won't proceed to call `on_deconstruction()`
meaning no machine will have a chance to spawn anything which is the
current behaviour.

This is required to make #81290 work for all machines at least so that
machine can send the `COMSIG_OBJ_DECONSTRUCT` signal without subtypes
overriding & forgetting to call the parent proc

- `dump_contents()` only gets called when the machine is deconstructed
not destroyed thus not leaving behind any of its contents inside. Fixes
https://github.com/tgstation/tgstation/pull/81290#issuecomment-1925752583

## Changelog
🆑
fix: machines that should not drop contents when deleted no longer do.
refactor: refactors how machines are deconstructed. report bugs on
github.
/🆑

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>

* Refactors how machines are deconstructed

* is this it?

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
Co-authored-by: Useroth <37159550+Useroth@users.noreply.github.com>
2024-02-20 01:49:51 +01:00

26 lines
1.1 KiB
Plaintext

/obj/machinery/rnd/production/protolathe
name = "protolathe"
desc = "Converts raw materials into useful objects."
icon_state = "protolathe"
circuit = /obj/item/circuitboard/machine/protolathe
production_animation = "protolathe_n"
allowed_buildtypes = PROTOLATHE
/obj/machinery/rnd/production/protolathe/on_deconstruction(disassembled)
log_game("Protolathe of type [type] [disassembled ? "disassembled" : "deconstructed"] by [key_name(usr)] at [get_area_name(src, TRUE)]")
return ..()
/obj/machinery/rnd/production/protolathe/Initialize(mapload)
if(!mapload)
log_game("Protolathe of type [type] constructed by [key_name(usr)] at [get_area_name(src, TRUE)]")
return ..()
/// Special subtype protolathe for offstation use. Has a more limited available design selection.
/obj/machinery/rnd/production/protolathe/offstation
name = "ancient protolathe"
desc = "Converts raw materials into useful objects. Its ancient construction may limit its ability to print all known technology."
circuit = /obj/item/circuitboard/machine/protolathe/offstation
allowed_buildtypes = AWAY_LATHE