Files
Bubberstation/code/datums/elements/wall_tearer.dm
grungussuss 58501dce77 Reorganizes the sound folder (#86726)
## About The Pull Request

<details>

- renamed ai folder to announcer

-- announcer --
- moved vox_fem to announcer
- moved approachingTG to announcer

- separated the ambience folder into ambience and instrumental
-- ambience --

- created holy folder moved all related sounds there
- created engineering folder and moved all related sounds there
- created security folder and moved ambidet there
- created general folder and moved ambigen there
- created icemoon folder and moved all icebox-related ambience there
- created medical folder and moved all medbay-related ambi there
- created ruin folder and moves all ruins ambi there
- created beach folder and moved seag and shore there
- created lavaland folder and moved related ambi there
- created aurora_caelus folder and placed its ambi there
- created misc folder and moved the rest of the files that don't have a
specific category into it

-- instrumental --

- moved traitor folder here
- created lobby_music folder and placed our songs there (title0 not used
anywhere? - server-side modification?)

-- items --

- moved secdeath to hailer
- moved surgery to handling

-- effects --

- moved chemistry into effects
- moved hallucinations into effects
- moved health into effects
- moved magic into effects

-- vehicles --

- moved mecha into vehicles


created mobs folder

-- mobs --

- moved creatures folder into mobs
- moved voice into mobs

renamed creatures to non-humanoids
renamed voice to humanoids

-- non-humanoids--

created cyborg folder
created hiss folder
moved harmalarm.ogg to cyborg

-- humanoids --




-- misc --

moved ghostwhisper to misc
moved insane_low_laugh to misc

I give up trying to document this.

</details>

- [X] ambience
- [x] announcer
- [x] effects
- [X] instrumental
- [x] items
- [x] machines
- [x] misc 
- [X] mobs
- [X] runtime
- [X] vehicles

- [ ] attributions

## Why It's Good For The Game

This folder is so disorganized that it's vomit inducing, will make it
easier to find and add new sounds, providng a minor structure to the
sound folder.

## Changelog
🆑 grungussuss
refactor: the sound folder in the source code has been reorganized,
please report any oddities with sounds playing or not playing
server: lobby music has been repathed to sound/music/lobby_music
/🆑
2024-09-23 22:24:50 -07:00

83 lines
3.6 KiB
Plaintext

/// Returned if we can rip up this target
#define WALL_TEAR_ALLOWED TRUE
/// Returned if we can't rip up this target
#define WALL_TEAR_INVALID FALSE
/// Returned if we can't rip up the target but still don't want to attack it
#define WALL_TEAR_FAIL_CANCEL_CHAIN -1
/**
* Allows attached mobs to destroy walls over time, a little less unreasonable than the instant wall deletion of wall_smasher
*/
/datum/element/wall_tearer
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// Whether we can break reinforced walls
var/allow_reinforced
/// How long it takes for us to destroy a wall completely (its a 3 step process so this will be divided by three)
var/tear_time
/// How much longer it takes to break reinforced walls
var/reinforced_multiplier
/// What interaction key do we use for our interaction
var/do_after_key
/datum/element/wall_tearer/Attach(datum/target, allow_reinforced = TRUE, tear_time = 2 SECONDS, reinforced_multiplier = 2, do_after_key = null)
. = ..()
if (!isliving(target))
return ELEMENT_INCOMPATIBLE
src.allow_reinforced = allow_reinforced
src.tear_time = tear_time
src.reinforced_multiplier = reinforced_multiplier
src.do_after_key = do_after_key
RegisterSignals(target, list(COMSIG_HOSTILE_PRE_ATTACKINGTARGET, COMSIG_LIVING_UNARMED_ATTACK), PROC_REF(on_attacked_wall))
/datum/element/wall_tearer/Detach(datum/source)
. = ..()
UnregisterSignal(source, list(COMSIG_HOSTILE_PRE_ATTACKINGTARGET, COMSIG_LIVING_UNARMED_ATTACK))
/// Try to tear up a wall
/datum/element/wall_tearer/proc/on_attacked_wall(mob/living/tearer, atom/target, proximity_flag)
SIGNAL_HANDLER
if (DOING_INTERACTION_WITH_TARGET(tearer, target) || (!isnull(do_after_key) && DOING_INTERACTION(tearer, do_after_key)))
tearer.balloon_alert(tearer, "busy!")
return COMPONENT_HOSTILE_NO_ATTACK
var/is_valid = validate_target(target, tearer)
if (is_valid != WALL_TEAR_ALLOWED)
return is_valid == WALL_TEAR_FAIL_CANCEL_CHAIN ? COMPONENT_HOSTILE_NO_ATTACK : NONE
INVOKE_ASYNC(src, PROC_REF(rip_and_tear), tearer, target)
return COMPONENT_HOSTILE_NO_ATTACK
/datum/element/wall_tearer/proc/rip_and_tear(mob/living/tearer, atom/target)
// We need to do this three times to actually destroy it
var/rip_time = (istype(target, /turf/closed/wall/r_wall) ? tear_time * reinforced_multiplier : tear_time) / 3
if (rip_time > 0)
tearer.visible_message(span_warning("[tearer] begins tearing through [target]!"))
playsound(tearer, 'sound/machines/airlock/airlock_alien_prying.ogg', vol = 100, vary = TRUE)
target.balloon_alert(tearer, "tearing...")
if (!do_after(tearer, delay = rip_time, target = target, interaction_key = do_after_key))
tearer.balloon_alert(tearer, "interrupted!")
return
// Might have been replaced, removed, or reinforced during our do_after
var/is_valid = validate_target(target, tearer)
if (is_valid != WALL_TEAR_ALLOWED)
return
tearer.do_attack_animation(target)
target.AddComponent(/datum/component/torn_wall)
is_valid = validate_target(target, tearer) // And now we might have just destroyed it
if (is_valid == WALL_TEAR_ALLOWED)
tearer.UnarmedAttack(target, proximity_flag = TRUE)
/// Check if the target atom is a wall we can actually rip up
/datum/element/wall_tearer/proc/validate_target(atom/target, mob/living/tearer)
if (!isclosedturf(target) || isindestructiblewall(target))
return WALL_TEAR_INVALID
var/reinforced = istype(target, /turf/closed/wall/r_wall)
if (!allow_reinforced && reinforced)
target.balloon_alert(tearer, "it's too strong!")
return WALL_TEAR_FAIL_CANCEL_CHAIN
return WALL_TEAR_ALLOWED
#undef WALL_TEAR_ALLOWED
#undef WALL_TEAR_INVALID
#undef WALL_TEAR_FAIL_CANCEL_CHAIN