mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-29 02:51:41 +00:00
* Refactors memories to be less painful to add and apply, moves memory detail / text to memory subtypes. Adds some new memories to demonstrate. (#72110) So, a huge issue with memories and - what I personally believe is the reason why not many have been added since their inception is - they're very annoying to add! Normally, adding subtypes of stuff like traumas or hallucinations are as easy as doing just that, adding a subtype. But memories used this factory argument passing method combined with holding all their strings in a JSON file which made it just frustrating to add, debug, or just mess with. It also made it much harder to organize new memories keep it clean for stuff like downstreams. So I refactored it. Memories are now handled on a subtype by subtype basis, instead of all memories being a `/datum/memory`. Any variety of arguments can be passed into memories like addcomponent (KWARGS) so each subtype can have their own `new` parameters. This makes it much much easier to add a new memory. All you need to do is make your subtype and add it somewhere. Don't need to mess with jsons or defines or anything. To demonstrate this, I added a few memories. Some existing memories had their story values tweak to compensate. Makes it way simpler to add new memories. Maybe we'll get some more fun ones now? 🆑 Melbert add: Roundstart captains will now memorize the code to the spare ID safe. add: Traitors will now memorize the location and code to their uplink. add: Heads of staff winning a revolution will now get a memory of their success. add: Heads of staff and head revolutionaries who lose their respective sides of the revolution also get a memory of their failure. add: Completing a ritual of knowledge as a heretic grants you a quality memory. add: Successfully defusing a bomb now grants you a cool memory. Failing it will also grant you a memory, though you will likely not be alive to see it. add: Planting bombs now increase their memory quality depending on how cool the bomb is. refactor: Memories have been refactored to be much easier to add. /🆑 * Modular! Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Funce <funce.973@gmail.com>
81 lines
3.5 KiB
Plaintext
81 lines
3.5 KiB
Plaintext
/// An element that will make a target thing do damage to any mob that it falls on from a z-level above
|
|
/datum/element/falling_hazard
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
|
|
/// The amount of damage to do when the target falls onto a mob
|
|
var/fall_damage = 5
|
|
/// The wound bonus to give damage dealt against mobs we fall on
|
|
var/fall_wound_bonus = 0
|
|
/// Does we take into consideration if the target has head protection (hardhat, or a strong enough helmet)
|
|
var/obeys_hardhats = TRUE
|
|
/// Does the target crush and flatten whoever it falls on
|
|
var/crushes_people = FALSE
|
|
/// What sound is played when the target falls onto a mob
|
|
var/impact_sound = 'sound/magic/clockwork/fellowship_armory.ogg' //CLANG
|
|
|
|
/datum/element/falling_hazard/Attach(datum/target, damage, wound_bonus, hardhat_safety, crushes, impact_sound)
|
|
. = ..()
|
|
if(!isatom(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
src.fall_damage = damage
|
|
src.fall_wound_bonus = wound_bonus
|
|
src.obeys_hardhats = hardhat_safety
|
|
src.crushes_people = crushes
|
|
src.impact_sound = impact_sound
|
|
|
|
RegisterSignal(target, COMSIG_ATOM_ON_Z_IMPACT, PROC_REF(fall_onto_stuff))
|
|
|
|
/datum/element/falling_hazard/Detach(datum/target)
|
|
. = ..()
|
|
UnregisterSignal(target, COMSIG_ATOM_ON_Z_IMPACT)
|
|
|
|
/// Gathers every mob in the turf the target falls on, and does damage/crushes them/makes a message about the target falling on them
|
|
/datum/element/falling_hazard/proc/fall_onto_stuff(datum/source, turf/impacted_turf, levels)
|
|
SIGNAL_HANDLER
|
|
|
|
var/mob/living/poor_target = locate(/mob/living) in impacted_turf
|
|
|
|
if(!poor_target)
|
|
return
|
|
|
|
var/target_head_armor = poor_target.run_armor_check(BODY_ZONE_HEAD, MELEE, silent = TRUE)
|
|
|
|
if(obeys_hardhats && target_head_armor >= 15) // 15 melee armor is enough that most head items dont have this, but anything above a hardhat should protect you
|
|
poor_target.visible_message(
|
|
span_warning("[source] falls on [poor_target], thankfully [poor_target.p_they()] had a helmet on!"),
|
|
span_userdanger("You are hit on the head by [source], good thing you had a helmet on!"),
|
|
span_hear("You hear a [crushes_people ? "crash" : "bonk"]!"),
|
|
)
|
|
|
|
if(crushes_people)
|
|
poor_target.Knockdown(0.25 SECONDS * fall_damage) // For a piano, that would be 15 seconds
|
|
|
|
playsound(poor_target, 'sound/weapons/parry.ogg', 50, TRUE) // You PARRIED the falling object with your EPIC hardhat
|
|
return
|
|
|
|
var/obj/item/bodypart/target_head = poor_target.get_bodypart(BODY_ZONE_HEAD)
|
|
|
|
// This does more damage the more levels the falling object has fallen
|
|
if(!crushes_people && target_head)
|
|
poor_target.apply_damage(fall_damage * levels, def_zone = BODY_ZONE_HEAD, forced = TRUE, wound_bonus = fall_wound_bonus)
|
|
else
|
|
poor_target.apply_damage(fall_damage * levels, forced = TRUE, spread_damage = TRUE, wound_bonus = fall_wound_bonus)
|
|
|
|
poor_target.visible_message(
|
|
span_userdanger("[source] falls on [poor_target], [crushes_people ? "crushing [poor_target.p_them()]" : "hitting [poor_target.p_them()]"] [target_head ? "on the head!" : "!"]"),
|
|
span_userdanger("You are [crushes_people ? "crushed" : "hit"] by [source]!"),
|
|
span_hear("You hear a [crushes_people ? "crash" : "bonk"]!"),
|
|
)
|
|
|
|
playsound(poor_target, impact_sound, 50, TRUE)
|
|
|
|
if(!crushes_people)
|
|
return
|
|
|
|
if(iscarbon(poor_target))
|
|
poor_target.AddElement(/datum/element/squish, 30 SECONDS)
|
|
poor_target.Paralyze(0.5 SECONDS * fall_damage) // For a piano, that would be 30 seconds
|
|
add_memory_in_range(poor_target, 7, /datum/memory/witness_vendor_crush, protagonist = poor_target, antagonist = source)
|