mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 19:22:20 +00:00
## About The Pull Request Separates all the quirts out of the positive, neutral and negative files into their own files. The smoker and alcoholic quirks are left with junkie as they are subtypes of it. ## Why It's Good For The Game These three code files were chonkers at 400, 483 and 1564 lines. They were run on files of types only connected by all being quirks, and made it hard to navigate these files without the user's eye sliding from one quirk to the next. Breaking them down makes it easy to look at the code for a specific quirk indepentently, and also allows looking between multiple quirks without having to scroll around the same file. ## Changelog No player facing changes
51 lines
2.2 KiB
Plaintext
51 lines
2.2 KiB
Plaintext
/datum/quirk/badback
|
|
name = "Bad Back"
|
|
desc = "Thanks to your poor posture, backpacks and other bags never sit right on your back. More evenly weighted objects are fine, though."
|
|
icon = FA_ICON_HIKING
|
|
value = -8
|
|
quirk_flags = QUIRK_HUMAN_ONLY|QUIRK_MOODLET_BASED
|
|
gain_text = span_danger("Your back REALLY hurts!")
|
|
lose_text = span_notice("Your back feels better.")
|
|
medical_record_text = "Patient scans indicate severe and chronic back pain."
|
|
hardcore_value = 4
|
|
mail_goodies = list(/obj/item/cane)
|
|
var/datum/weakref/backpack
|
|
|
|
/datum/quirk/badback/add(client/client_source)
|
|
var/mob/living/carbon/human/human_holder = quirk_holder
|
|
var/obj/item/storage/backpack/equipped_backpack = human_holder.back
|
|
if(istype(equipped_backpack))
|
|
quirk_holder.add_mood_event("back_pain", /datum/mood_event/back_pain)
|
|
RegisterSignal(human_holder.back, COMSIG_ITEM_POST_UNEQUIP, PROC_REF(on_unequipped_backpack))
|
|
else
|
|
RegisterSignal(quirk_holder, COMSIG_MOB_EQUIPPED_ITEM, PROC_REF(on_equipped_item))
|
|
|
|
/datum/quirk/badback/remove()
|
|
UnregisterSignal(quirk_holder, COMSIG_MOB_EQUIPPED_ITEM)
|
|
|
|
var/obj/item/storage/equipped_backpack = backpack?.resolve()
|
|
if(equipped_backpack)
|
|
UnregisterSignal(equipped_backpack, COMSIG_ITEM_POST_UNEQUIP)
|
|
quirk_holder.clear_mood_event("back_pain")
|
|
|
|
/// Signal handler for when the quirk_holder equips an item. If it's a backpack, adds the back_pain mood event.
|
|
/datum/quirk/badback/proc/on_equipped_item(mob/living/source, obj/item/equipped_item, slot)
|
|
SIGNAL_HANDLER
|
|
|
|
if(!(slot & ITEM_SLOT_BACK) || !istype(equipped_item, /obj/item/storage/backpack))
|
|
return
|
|
|
|
quirk_holder.add_mood_event("back_pain", /datum/mood_event/back_pain)
|
|
RegisterSignal(equipped_item, COMSIG_ITEM_POST_UNEQUIP, PROC_REF(on_unequipped_backpack))
|
|
UnregisterSignal(quirk_holder, COMSIG_MOB_EQUIPPED_ITEM)
|
|
backpack = WEAKREF(equipped_item)
|
|
|
|
/// Signal handler for when the quirk_holder unequips an equipped backpack. Removes the back_pain mood event.
|
|
/datum/quirk/badback/proc/on_unequipped_backpack(obj/item/source, force, atom/newloc, no_move, invdrop, silent)
|
|
SIGNAL_HANDLER
|
|
|
|
UnregisterSignal(source, COMSIG_ITEM_POST_UNEQUIP)
|
|
quirk_holder.clear_mood_event("back_pain")
|
|
backpack = null
|
|
RegisterSignal(quirk_holder, COMSIG_MOB_EQUIPPED_ITEM, PROC_REF(on_equipped_item))
|