Files
Bubberstation/code/datums/components/cuff_n_stun.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

102 lines
3.2 KiB
Plaintext

/*
* A component to stun and cuff targets
*/
/datum/component/stun_n_cuff
/// mobs we cannot stun nor cuff
var/list/blacklist_mobs
///sound to play when stunning
var/stun_sound
///time to stun the target for
var/stun_timer
///time it takes for us to handcuff the target
var/handcuff_timer
///callback after we have stunned someone
var/datum/callback/post_stun_callback
///callback after we have arrested someone
var/datum/callback/post_arrest_callback
///time until we can stun again
var/stun_cooldown_timer
///type of cuffs we use
var/handcuff_type
///cooldown until we can stun again
COOLDOWN_DECLARE(stun_cooldown)
/datum/component/stun_n_cuff/Initialize(list/blacklist_mobs = list(),
stun_sound = 'sound/items/weapons/egloves.ogg',
stun_timer = 8 SECONDS,
handcuff_timer = 4 SECONDS,
stun_cooldown_timer = 10 SECONDS,
handcuff_type = /obj/item/restraints/handcuffs/cable/zipties/used,
post_stun_callback,
post_arrest_callback,
)
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
src.blacklist_mobs = blacklist_mobs
src.stun_sound = stun_sound
src.stun_timer = stun_timer
src.handcuff_timer = handcuff_timer
src.handcuff_type = handcuff_type
src.stun_cooldown_timer = stun_cooldown_timer
src.post_stun_callback = post_stun_callback
src.post_arrest_callback = post_arrest_callback
/datum/component/stun_n_cuff/RegisterWithParent()
RegisterSignal(parent, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, PROC_REF(on_unarmed_attack))
/datum/component/stun_n_cuff/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_HOSTILE_PRE_ATTACKINGTARGET)
REMOVE_TRAIT(parent, TRAIT_MOB_BREEDER, REF(src))
post_stun_callback = null
post_arrest_callback = null
/datum/component/stun_n_cuff/proc/on_unarmed_attack(mob/living/source, atom/target)
SIGNAL_HANDLER
if(target == source || !iscarbon(target))
return NONE
if(is_type_in_typecache(target, blacklist_mobs))
return NONE
var/mob/living/carbon/living_target = target
if(living_target.IsParalyzed())
INVOKE_ASYNC(src, PROC_REF(cuff_target), target)
else
stun_target(target)
return COMPONENT_HOSTILE_NO_ATTACK
/datum/component/stun_n_cuff/proc/cuff_target(mob/living/carbon/human_target)
if(human_target.handcuffed)
var/mob/living/living_parent = parent
living_parent.balloon_alert(human_target, "already cuffed!")
return
playsound(parent, 'sound/items/weapons/cablecuff.ogg', 30, TRUE)
human_target.visible_message(span_danger("[parent] is trying to put zipties on [human_target]!"),\
span_danger("[parent] is trying to put zipties on you!"))
if(!do_after(parent, handcuff_timer, human_target))
return
human_target.set_handcuffed(new handcuff_type(human_target))
human_target.update_handcuffed()
post_arrest_callback?.Invoke(human_target)
/datum/component/stun_n_cuff/proc/stun_target(mob/living/carbon/human_target)
if(!COOLDOWN_FINISHED(src, stun_cooldown))
return
playsound(parent, stun_sound, 50, TRUE)
human_target.Paralyze(stun_timer)
human_target.set_stutter(40 SECONDS)
log_combat(parent, human_target, "honked")
human_target.visible_message(
span_danger("[parent] stuns [human_target]!"), \
span_userdanger("[parent] stuns you!"), \
)
COOLDOWN_START(src, stun_cooldown, stun_cooldown_timer)
post_stun_callback?.Invoke(human_target)