mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-12 01:43:40 +00:00
* [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.1583cf0cc9/code/game/machinery/_machinery.dm (L958-L959)Our recent removal of `NO_DECONSTRUCTION`, however, has left this to _only_ be the latter.f0ed4ba4ce/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>
84 lines
3.2 KiB
Plaintext
84 lines
3.2 KiB
Plaintext
GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0,0,0)))
|
|
|
|
///simple element to handle frozen obj's
|
|
/datum/element/frozen
|
|
|
|
/datum/element/frozen/Attach(datum/target)
|
|
. = ..()
|
|
if(!isobj(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
var/obj/target_obj = target
|
|
if(target_obj.resistance_flags & FREEZE_PROOF)
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
if(HAS_TRAIT(target_obj, TRAIT_FROZEN))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
ADD_TRAIT(target_obj, TRAIT_FROZEN, ELEMENT_TRAIT(type))
|
|
target_obj.name = "frozen [target_obj.name]"
|
|
target_obj.add_atom_colour(GLOB.freon_color_matrix, TEMPORARY_COLOUR_PRIORITY)
|
|
target_obj.alpha -= 25
|
|
|
|
if (isinternalorgan(target))
|
|
var/obj/item/organ/internal/organ = target
|
|
organ.organ_flags |= ORGAN_FROZEN
|
|
else if (isbodypart(target))
|
|
for(var/obj/item/organ/internal/organ in target_obj.contents)
|
|
organ.organ_flags |= ORGAN_FROZEN
|
|
|
|
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
|
|
RegisterSignal(target, COMSIG_MOVABLE_THROW_LANDED, PROC_REF(shatter_on_throw))
|
|
RegisterSignal(target, COMSIG_MOVABLE_IMPACT, PROC_REF(shatter_on_throw))
|
|
RegisterSignal(target, COMSIG_OBJ_UNFREEZE, PROC_REF(on_unfreeze))
|
|
|
|
/datum/element/frozen/Detach(datum/source, ...)
|
|
var/obj/obj_source = source
|
|
REMOVE_TRAIT(obj_source, TRAIT_FROZEN, ELEMENT_TRAIT(type))
|
|
UnregisterSignal(obj_source, list(COMSIG_MOVABLE_MOVED, COMSIG_MOVABLE_THROW_LANDED, COMSIG_MOVABLE_IMPACT, COMSIG_OBJ_UNFREEZE))
|
|
obj_source.name = replacetext(obj_source.name, "frozen ", "")
|
|
obj_source.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, GLOB.freon_color_matrix)
|
|
obj_source.alpha += 25
|
|
|
|
if (isinternalorgan(source))
|
|
var/obj/item/organ/internal/organ = source
|
|
organ.organ_flags &= ~ORGAN_FROZEN
|
|
else if (isbodypart(source))
|
|
for(var/obj/item/organ/internal/organ in obj_source.contents)
|
|
organ.organ_flags &= ~ORGAN_FROZEN
|
|
|
|
return ..()
|
|
|
|
///signal handler for COMSIG_OBJ_UNFREEZE that forces us to detach from the target
|
|
/datum/element/frozen/proc/on_unfreeze(datum/source)
|
|
SIGNAL_HANDLER
|
|
Detach(source)
|
|
|
|
///signal handler for COMSIG_MOVABLE_POST_THROW that shatters our target after impacting after a throw
|
|
/datum/element/frozen/proc/shatter_on_throw(datum/target, datum/thrownthing/throwingdatum)
|
|
SIGNAL_HANDLER
|
|
var/obj/obj_target = target
|
|
if(ismob(throwingdatum.thrower))
|
|
log_combat(throwingdatum.thrower, target, "shattered", addition = "from being thrown due to [target] being frozen.")
|
|
else
|
|
log_combat(throwingdatum.thrower, target, "launched", addition = "shattering it due to being frozen.")
|
|
obj_target.visible_message(span_danger("[obj_target] shatters into a million pieces!"))
|
|
obj_target.obj_flags |= NO_DEBRIS_AFTER_DECONSTRUCTION // disable item spawning
|
|
obj_target.deconstruct(FALSE) // call pre-deletion specialized code -- internals release gas etc
|
|
|
|
/// signal handler for COMSIG_MOVABLE_MOVED that unfreezes our target if it moves onto an open turf thats hotter than
|
|
/// our melting temperature.
|
|
/datum/element/frozen/proc/on_moved(datum/target)
|
|
SIGNAL_HANDLER
|
|
var/atom/movable/movable_target = target
|
|
|
|
if(movable_target.throwing)
|
|
return
|
|
|
|
if(!isopenturf(movable_target.loc))
|
|
return
|
|
|
|
var/turf/open/turf_loc = movable_target.loc
|
|
if(turf_loc.air?.temperature >= T0C)//unfreezes target
|
|
Detach(target)
|