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

92 lines
3.2 KiB
Plaintext

#define SHIELD_FILTER "shield filter"
/// gives the mobs a regenerative shield, it will tank hits for them and then need to recharge for a bit
/datum/component/regenerative_shield
///number of hits we can tank
var/number_of_hits = 15
///the limit of the damage we can tank
var/damage_threshold
///the overlay of the shield
var/list/shield_overlays = list()
///how long before the shield can regenerate
var/regeneration_time
/datum/component/regenerative_shield/Initialize(number_of_hits = 15, damage_threshold = 50, regeneration_time = 2 MINUTES, list/shield_overlays)
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
src.number_of_hits = number_of_hits
src.damage_threshold = damage_threshold
src.regeneration_time = regeneration_time
var/atom/movable/living_parent = parent
for(var/type_path as anything in shield_overlays)
if(!ispath(type_path))
continue
var/obj/effect/overlay/new_effect = new type_path()
living_parent.vis_contents += new_effect
apply_filter_effects(new_effect)
src.shield_overlays += new_effect
/datum/component/regenerative_shield/RegisterWithParent()
. = ..()
ADD_TRAIT(parent, TRAIT_REGEN_SHIELD, REF(src))
RegisterSignal(parent, COMSIG_LIVING_CHECK_BLOCK, PROC_REF(block_attack))
/datum/component/regenerative_shield/UnregisterFromParent()
var/atom/movable/living_parent = parent
for(var/obj/effect/overlay as anything in shield_overlays)
living_parent.vis_contents -= overlay
QDEL_LIST(shield_overlays)
UnregisterSignal(parent, COMSIG_LIVING_CHECK_BLOCK)
REMOVE_TRAIT(parent, TRAIT_REGEN_SHIELD, REF(src))
return ..()
/datum/component/regenerative_shield/proc/block_attack(
mob/living/source,
atom/hitby,
damage,
attack_text,
attack_type,
armour_penetration,
damage_type,
attack_flag,
)
SIGNAL_HANDLER
if(damage <= 0 ||damage_type == STAMINA)
return NONE
if(damage >= damage_threshold || number_of_hits <= 0)
return NONE
playsound(get_turf(parent), 'sound/items/weapons/tap.ogg', 20)
new /obj/effect/temp_visual/guardian/phase/out(get_turf(parent))
number_of_hits = max(0, number_of_hits - 1)
if(number_of_hits <= 0)
disable_shield()
return SUCCESSFUL_BLOCK
/datum/component/regenerative_shield/proc/disable_shield()
addtimer(CALLBACK(src, PROC_REF(enable_shield)), regeneration_time)
for(var/obj/effect/my_effect as anything in shield_overlays)
animate(my_effect, alpha = 0, time = 3 SECONDS)
my_effect.remove_filter(SHIELD_FILTER)
playsound(parent, 'sound/vehicles/mecha/mech_shield_drop.ogg', 20)
/datum/component/regenerative_shield/proc/enable_shield()
number_of_hits = initial(number_of_hits)
for(var/obj/effect/my_effect as anything in shield_overlays)
animate(my_effect, alpha = 255, time = 3 SECONDS)
addtimer(CALLBACK(src, PROC_REF(apply_filter_effects), my_effect), 5 SECONDS)
playsound(parent, 'sound/vehicles/mecha/mech_shield_raise.ogg', 20)
/datum/component/regenerative_shield/proc/apply_filter_effects(obj/effect/new_effect)
if(isnull(new_effect))
return
new_effect.add_filter(SHIELD_FILTER, 1, list("type" = "outline", "color" = "#b6e6f3", "alpha" = 0, "size" = 1))
var/filter = new_effect.get_filter(SHIELD_FILTER)
animate(filter, alpha = 200, time = 0.5 SECONDS, loop = -1)
animate(alpha = 0, time = 0.5 SECONDS)
#undef SHIELD_FILTER