Files
Bubberstation/modular_skyrat/modules/primitive_structures/code/storage_structures.dm
T
91946bbab6 Cherry-pick of all NO DESTRUCTION (#27477)
* [NO GBP] Patches & renaming for `NO_DECONSTRUCTION` flag (#82547)

## About The Pull Request

1. Renames `NO_DECONSTRUCTION` -> `NO_DEBRIS_AFTER_DECONSTRUCTION`. As
the name suggests when the object is deconstructed it won't drop any
items/debris. After my last refactor for this flag it now serves a new
purpose so its name has been changed to match that

2. Fixes objects that are now using `NO_DECONSTRUCTION` incorrectly.
Some of these changes include
- Removing the flag in objects where there are no means to deconstruct
them (e.g. jukebox, hydroponics soil, flora etc)
- Replacing the flags old purpose by overriding its tool procs so that
it regains its old behaviour(e.g. You once again cannot deconstruct ctf
reinforced tables, survival pods, indestructible windows etc)

## Changelog
🆑
code: renamed `NO_DECONSTRUCTION` to `NO_DEBRIS_AFTER_DECONSTRUCTION` so
its name matches its intended purpose
fix: fixes some items that incorrectly used `NO_DECONSTRUCTION` prior to
its refactor, meaning makes some objects non deconstructable again
/🆑

* NO DESTRUCTION

* Linter fix

* Fixes standard RPEDs not working on machines (#82528)

## About The Pull Request

Previously, `exchange_parts(...)` would cancel if both the
`NO_DECONSTRUCTION` flag was set and you couldn't use your part replacer
from a distance.

https://github.com/tgstation/tgstation/blob/1583cf0cc968cd9f5da2398035feb8d70d58bcf2/code/game/machinery/_machinery.dm#L958-L959
Our recent removal of `NO_DECONSTRUCTION`, however, has left this to
_only_ be the latter.

https://github.com/tgstation/tgstation/blob/f0ed4ba4ce6b114509c10ee2f36ab0af6d7c81d2/code/game/machinery/_machinery.dm#L956-L957
Buuuuut this makes it unconditionally cancel for normal RPEDs, instead
of only blocking them if `NO_DECONSTRUCTION` was set.

As `NO_DECONSTRUCTION` is very much no longer relevant for this purpose,
we simply remove the ranged RPED check altogether.
This fixes our issue.
## Why It's Good For The Game

Fixes #82525.
## Changelog
🆑
fix: Standard RPEDs work on machines again.
/🆑

* Machinery Destroy() side effect clean up (#82659)

## About The Pull Request

I have combed over implementations of `Destroy()` for `obj/machinery`,
and noticed quite a few was spawning items or playing sounds.

**Slot machines**:
Moved payout to on_deconstruction()

**Windoors**:
Break sound moved to on_deconstruction().
I have also slightly cleaned up Destroy(), the windoor calls
air_update_turf directly, as that proc already retrieves the turf it is
on.
 
**Atmospheric pipe**:
Releases air and deconstructs meter objects on_deconstruction().

**Portable atmospheric devices**:
Drop hyper noblium crystal on on_destruction().

**Pump, Scrubbers**:
Releases air on_deconstruction().

**PACMAN power generator**:
Spawns dropped fuel on_deconstruction().

**Runic vendor**:
Moved vanishing effects to on_deconstruction().

I did not change Destroy side effects in the following instances:

- side effects are critical for the round (e.g. doomsday device, nuke,
blackbox recorder dropping the tape, gulag item reclaimer [less critical
but still])
- might spawn messages and noises, but moving them to on_deconstruct
would put linked items into an unusable state if deleted directly (e.g.
express order console, cyborg lockdown console, tram paired sensors)
- would potentially delete mobs we don't want deleted (e.g. disposals,
slime camera console)

Out of 220 Destroy defines, I found only 8 side effects that could not
be moved to other procs, so `machinery\Destroy()` has almost always been
used properly! I really hope `structure` will be as well made.

Other changes:

- Stasis beds had a completely empty destroy, removed
- Mass drivers had two destroy procs, merged

## Why It's Good For The Game

The Destroy() proc should only contain reference clean ups, barring edge
cases that would harm playability.

## Changelog

Nothing player facing.

* Fix linter

* icon fix

* icon fix again

---------

Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>
Co-authored-by: _0Steven <42909981+00-Steven@users.noreply.github.com>
Co-authored-by: Profakos <profakos@gmail.com>
2024-04-27 03:16:47 +02:00

127 lines
4.7 KiB
Plaintext

// Wooden shelves that force items placed on them to be visually placed them
/obj/structure/rack/wooden
name = "shelf"
icon_state = "shelf_wood"
icon = 'modular_skyrat/modules/primitive_structures/icons/storage.dmi'
resistance_flags = FLAMMABLE
/obj/structure/rack/wooden/MouseDrop_T(obj/object, mob/user, params)
. = ..()
var/list/modifiers = params2list(params)
if(!LAZYACCESS(modifiers, ICON_X) || !LAZYACCESS(modifiers, ICON_Y))
return
object.pixel_x = clamp(text2num(LAZYACCESS(modifiers, ICON_X)) - 16, -(world.icon_size / 3), world.icon_size / 3)
object.pixel_y = text2num(LAZYACCESS(modifiers, ICON_Y)) > 16 ? 10 : -4
/obj/structure/rack/wrench_act_secondary(mob/living/user, obj/item/tool)
return NONE
/obj/structure/rack/wooden/crowbar_act(mob/living/user, obj/item/tool)
user.balloon_alert_to_viewers("disassembling...")
if(!tool.use_tool(src, user, 2 SECONDS, volume = 100))
return
new /obj/item/stack/sheet/mineral/clay(drop_location(), 5)
deconstruct(TRUE)
return ITEM_INTERACT_SUCCESS
/obj/structure/rack/wooden/atom_deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/mineral/wood(drop_location(), 2)
return ..()
// Barrel but it works like a crate
/obj/structure/closet/crate/wooden/storage_barrel
name = "storage barrel"
desc = "This barrel can't hold liquids, it can just hold things inside of it however!"
icon_state = "barrel"
base_icon_state = "barrel"
icon = 'modular_skyrat/modules/primitive_structures/icons/storage.dmi'
resistance_flags = FLAMMABLE
material_drop = /obj/item/stack/sheet/mineral/wood
material_drop_amount = 4
cutting_tool = /obj/item/crowbar
/obj/machinery/smartfridge/wooden
name = "Debug Wooden Smartfridge"
desc = "You shouldn't be seeing this!"
icon = 'modular_skyrat/modules/primitive_structures/icons/storage.dmi'
icon_state = "producebin"
resistance_flags = FLAMMABLE
base_build_path = /obj/machinery/smartfridge/wooden
base_icon_state = "producebin"
use_power = NO_POWER_USE
light_power = 0
idle_power_usage = 0
circuit = null
has_emissive = FALSE
can_atmos_pass = ATMOS_PASS_YES
visible_contents = TRUE
/obj/machinery/smartfridge/wooden/Initialize(mapload)
. = ..()
if(type == /obj/machinery/smartfridge/wooden) // don't even let these prototypes exist
return INITIALIZE_HINT_QDEL
// previously NO_DECONSTRUCTION
/obj/machinery/smartfridge/wooden/default_deconstruction_screwdriver(mob/user, icon_state_open, icon_state_closed, obj/item/screwdriver)
return NONE
/obj/machinery/smartfridge/wooden/crowbar_act(mob/living/user, obj/item/tool)
user.balloon_alert_to_viewers("disassembling...")
if(!tool.use_tool(src, user, 2 SECONDS, volume = 100))
return
new /obj/item/stack/sheet/mineral/wood(drop_location(), 10)
deconstruct(TRUE)
return ITEM_INTERACT_SUCCESS
/obj/machinery/smartfridge/wooden/structure_examine()
. = span_info("The whole rack can be [EXAMINE_HINT("pried")] apart.")
/obj/machinery/smartfridge/wooden/produce_bin
name = "produce bin"
desc = "A wooden hamper, used to hold plant products and try to keep them safe from pests."
icon_state = "producebin"
base_build_path = /obj/machinery/smartfridge/wooden/produce_bin
base_icon_state = "producebin"
/obj/machinery/smartfridge/wooden/produce_bin/accept_check(obj/item/item_to_check)
var/static/list/accepted_items = list(
/obj/item/food/grown,
/obj/item/grown,
/obj/item/graft,
)
return is_type_in_list(item_to_check, accepted_items)
/obj/machinery/smartfridge/wooden/seed_shelf
name = "Seedshelf"
desc = "A wooden shelf, used to hold seeds preventing them from germinating early."
icon_state = "seedshelf"
base_build_path = /obj/machinery/smartfridge/wooden/seed_shelf
base_icon_state = "seed"
/obj/machinery/smartfridge/wooden/seedshelf/wooden/accept_check(obj/item/weapon)
return istype(weapon, /obj/item/seeds)
/obj/machinery/smartfridge/wooden/ration_shelf
name = "Ration shelf"
desc = "A wooden shelf, used to store food... preferably preserved."
icon_state = "rationshelf"
base_build_path = /obj/machinery/smartfridge/wooden/ration_shelf
base_icon_state = "ration"
/obj/machinery/smartfridge/wooden/rationshelf/wooden/accept_check(obj/item/weapon)
return (IS_EDIBLE(weapon) || (istype(weapon,/obj/item/reagent_containers/cup/bowl) && length(weapon.reagents?.reagent_list)))
/obj/machinery/smartfridge/wooden/produce_display
name = "Produce display"
desc = "A wooden table with awning, used to display produce items."
icon_state = "producedisplay"
base_build_path = /obj/machinery/smartfridge/wooden/produce_display
base_icon_state = "nonfood"
/obj/machinery/smartfridge/wooden/producedisplay/accept_check(obj/item/weapon)
return (istype(weapon, /obj/item/grown) || istype(weapon, /obj/item/bouquet) || istype(weapon, /obj/item/clothing/head/costume/garland))