mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-02 04:52:10 +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>
216 lines
7.6 KiB
Plaintext
216 lines
7.6 KiB
Plaintext
|
|
/obj/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
|
|
..()
|
|
take_damage(AM.throwforce, BRUTE, MELEE, 1, get_dir(src, AM))
|
|
|
|
/obj/ex_act(severity, target)
|
|
if(resistance_flags & INDESTRUCTIBLE)
|
|
return FALSE
|
|
|
|
. = ..() //contents explosion
|
|
if(QDELETED(src))
|
|
return TRUE
|
|
if(target == src)
|
|
take_damage(INFINITY, BRUTE, BOMB, 0)
|
|
return TRUE
|
|
switch(severity)
|
|
if(EXPLODE_DEVASTATE)
|
|
take_damage(INFINITY, BRUTE, BOMB, 0)
|
|
if(EXPLODE_HEAVY)
|
|
take_damage(rand(100, 250), BRUTE, BOMB, 0)
|
|
if(EXPLODE_LIGHT)
|
|
take_damage(rand(10, 90), BRUTE, BOMB, 0)
|
|
|
|
return TRUE
|
|
|
|
/obj/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit = FALSE)
|
|
. = ..()
|
|
if(. != BULLET_ACT_HIT)
|
|
return .
|
|
|
|
playsound(src, hitting_projectile.hitsound, 50, TRUE)
|
|
var/damage_sustained = 0
|
|
if(!QDELETED(src)) //Bullet on_hit effect might have already destroyed this object
|
|
damage_sustained = take_damage(
|
|
hitting_projectile.damage * hitting_projectile.demolition_mod,
|
|
hitting_projectile.damage_type,
|
|
hitting_projectile.armor_flag,
|
|
FALSE,
|
|
REVERSE_DIR(hitting_projectile.dir),
|
|
hitting_projectile.armour_penetration,
|
|
)
|
|
if(hitting_projectile.suppressed != SUPPRESSED_VERY)
|
|
visible_message(
|
|
span_danger("[src] is hit by \a [hitting_projectile][damage_sustained ? "" : ", [no_damage_feedback]"]!"),
|
|
vision_distance = COMBAT_MESSAGE_RANGE,
|
|
)
|
|
|
|
return damage_sustained > 0 ? BULLET_ACT_HIT : BULLET_ACT_BLOCK
|
|
|
|
/obj/attack_hulk(mob/living/carbon/human/user)
|
|
..()
|
|
if(density)
|
|
playsound(src, 'sound/effects/meteorimpact.ogg', 100, TRUE)
|
|
else
|
|
playsound(src, 'sound/effects/bang.ogg', 50, TRUE)
|
|
var/damage = take_damage(hulk_damage(), BRUTE, MELEE, 0, get_dir(src, user))
|
|
user.visible_message(span_danger("[user] smashes [src][damage ? "" : ", [no_damage_feedback]"]!"), span_danger("You smash [src][damage ? "" : ", [no_damage_feedback]"]!"), null, COMBAT_MESSAGE_RANGE)
|
|
return TRUE
|
|
|
|
/obj/blob_act(obj/structure/blob/B)
|
|
if (!..())
|
|
return
|
|
if(isturf(loc))
|
|
var/turf/T = loc
|
|
if(T.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(src, TRAIT_T_RAY_VISIBLE))
|
|
return
|
|
take_damage(400, BRUTE, MELEE, 0, get_dir(src, B))
|
|
|
|
/obj/attack_alien(mob/living/carbon/alien/adult/user, list/modifiers)
|
|
if(attack_generic(user, 60, BRUTE, MELEE, 0))
|
|
playsound(src.loc, 'sound/weapons/slash.ogg', 100, TRUE)
|
|
|
|
/obj/attack_animal(mob/living/simple_animal/user, list/modifiers)
|
|
. = ..()
|
|
if(!user.melee_damage_upper && !user.obj_damage)
|
|
user.emote("custom", message = "[user.friendly_verb_continuous] [src].")
|
|
return FALSE
|
|
else
|
|
var/turf/current_turf = get_turf(src) //we want to save the turf to play the sound there, cause being destroyed deletes us!
|
|
var/play_soundeffect = user.environment_smash
|
|
if(user.obj_damage)
|
|
. = attack_generic(user, user.obj_damage, user.melee_damage_type, MELEE, play_soundeffect, user.armour_penetration)
|
|
else
|
|
. = attack_generic(user, rand(user.melee_damage_lower,user.melee_damage_upper), user.melee_damage_type, MELEE, play_soundeffect, user.armour_penetration)
|
|
if(. && play_soundeffect)
|
|
playsound(current_turf, 'sound/effects/meteorimpact.ogg', 100, TRUE)
|
|
if(user.client)
|
|
log_combat(user, src, "attacked")
|
|
|
|
/obj/force_pushed(atom/movable/pusher, force = MOVE_FORCE_DEFAULT, direction)
|
|
return TRUE
|
|
|
|
/obj/move_crushed(atom/movable/pusher, force = MOVE_FORCE_DEFAULT, direction)
|
|
collision_damage(pusher, force, direction)
|
|
return TRUE
|
|
|
|
/obj/proc/collision_damage(atom/movable/pusher, force = MOVE_FORCE_DEFAULT, direction)
|
|
var/amt = max(0, ((force - (move_resist * MOVE_FORCE_CRUSH_RATIO)) / (move_resist * MOVE_FORCE_CRUSH_RATIO)) * 10)
|
|
take_damage(amt, BRUTE)
|
|
|
|
/obj/singularity_act()
|
|
SSexplosions.high_mov_atom += src
|
|
if(src && !QDELETED(src))
|
|
qdel(src)
|
|
return 2
|
|
|
|
|
|
///// ACID
|
|
|
|
///the obj's reaction when touched by acid
|
|
/obj/acid_act(acidpwr, acid_volume)
|
|
. = ..()
|
|
if((resistance_flags & UNACIDABLE) || (acid_volume <= 0) || (acidpwr <= 0))
|
|
return FALSE
|
|
if(QDELETED(src)) //skyrat edit: fix createanddestroy
|
|
return FALSE
|
|
AddComponent(/datum/component/acid, acidpwr, acid_volume, custom_acid_overlay || GLOB.acid_overlay)
|
|
return TRUE
|
|
|
|
///called when the obj is destroyed by acid.
|
|
/obj/proc/acid_melt()
|
|
deconstruct(FALSE)
|
|
|
|
//// FIRE
|
|
|
|
///Called when the obj is exposed to fire.
|
|
/obj/fire_act(exposed_temperature, exposed_volume)
|
|
if(isturf(loc))
|
|
var/turf/our_turf = loc
|
|
if(our_turf.underfloor_accessibility < UNDERFLOOR_INTERACTABLE && HAS_TRAIT(src, TRAIT_T_RAY_VISIBLE))
|
|
return
|
|
if(exposed_temperature && !(resistance_flags & FIRE_PROOF))
|
|
take_damage(clamp(0.02 * exposed_temperature, 0, 20), BURN, FIRE, 0)
|
|
if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE) && !(resistance_flags & FIRE_PROOF))
|
|
AddComponent(/datum/component/burning, custom_fire_overlay || GLOB.fire_overlay, burning_particles)
|
|
return TRUE
|
|
return ..()
|
|
|
|
/// Should be called when the atom is destroyed by fire, comparable to acid_melt() proc
|
|
/obj/proc/burn()
|
|
deconstruct(FALSE)
|
|
|
|
///Called when the obj is hit by a tesla bolt.
|
|
/obj/zap_act(power, zap_flags)
|
|
if(QDELETED(src))
|
|
return 0
|
|
ADD_TRAIT(src, TRAIT_BEING_SHOCKED, WAS_SHOCKED)
|
|
addtimer(TRAIT_CALLBACK_REMOVE(src, TRAIT_BEING_SHOCKED, WAS_SHOCKED), 1 SECONDS)
|
|
return power / 2
|
|
|
|
//The surgeon general warns that being buckled to certain objects receiving powerful shocks is greatly hazardous to your health
|
|
///Only tesla coils, vehicles, and grounding rods currently call this because mobs are already targeted over all other objects, but this might be useful for more things later.
|
|
/obj/proc/zap_buckle_check(strength)
|
|
if(has_buckled_mobs())
|
|
for(var/m in buckled_mobs)
|
|
var/mob/living/buckled_mob = m
|
|
buckled_mob.electrocute_act((clamp(round(strength * 1.25e-3), 10, 90) + rand(-5, 5)), src, flags = SHOCK_TESLA)
|
|
|
|
/**
|
|
* Custom behaviour per atom subtype on how they should deconstruct themselves
|
|
* Arguments
|
|
*
|
|
* * disassembled - TRUE means we cleanly took this atom apart using tools. FALSE means this was destroyed in a violent way
|
|
*/
|
|
/obj/proc/atom_deconstruct(disassembled = TRUE)
|
|
PROTECTED_PROC(TRUE)
|
|
|
|
return
|
|
|
|
/**
|
|
* The interminate proc between deconstruct() & atom_deconstruct(). By default this delegates deconstruction to
|
|
* atom_deconstruct if NO_DEBRIS_AFTER_DECONSTRUCTION is absent but subtypes can override this to handle NO_DEBRIS_AFTER_DECONSTRUCTION in their
|
|
* own unique way. Override this if for example you want to dump out important content like mobs from the
|
|
* atom before deconstruction regardless if NO_DEBRIS_AFTER_DECONSTRUCTION is present or not
|
|
* Arguments
|
|
*
|
|
* * disassembled - TRUE means we cleanly took this atom apart using tools. FALSE means this was destroyed in a violent way
|
|
*/
|
|
/obj/proc/handle_deconstruct(disassembled = TRUE)
|
|
SHOULD_CALL_PARENT(FALSE)
|
|
|
|
if(!(obj_flags & NO_DEBRIS_AFTER_DECONSTRUCTION))
|
|
atom_deconstruct(disassembled)
|
|
|
|
/**
|
|
* The obj is deconstructed into pieces, whether through careful disassembly or when destroyed.
|
|
* Arguments
|
|
*
|
|
* * disassembled - TRUE means we cleanly took this atom apart using tools. FALSE means this was destroyed in a violent way
|
|
*/
|
|
/obj/proc/deconstruct(disassembled = TRUE)
|
|
SHOULD_NOT_OVERRIDE(TRUE)
|
|
|
|
//allow objects to deconstruct themselves
|
|
handle_deconstruct(disassembled)
|
|
|
|
//inform objects we were deconstructed
|
|
SEND_SIGNAL(src, COMSIG_OBJ_DECONSTRUCT, disassembled)
|
|
|
|
//delete our self
|
|
qdel(src)
|
|
|
|
///what happens when the obj's integrity reaches zero.
|
|
/obj/atom_destruction(damage_flag)
|
|
. = ..()
|
|
if(damage_flag == ACID)
|
|
acid_melt()
|
|
else if(damage_flag == FIRE)
|
|
burn()
|
|
else
|
|
deconstruct(FALSE)
|
|
|
|
///returns how much the object blocks an explosion. Used by subtypes.
|
|
/obj/proc/GetExplosionBlock()
|
|
CRASH("Unimplemented GetExplosionBlock()")
|