mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 00:55:20 +01:00
11d82b7995
People can now pet held mothroaches and pugs if they want to, or use items on them, hopefully without causing many issues. After all, it only took about a couple dozen lines of code to make... ...Oh, did the 527 files changed or the 850~ lines added/removed perhaps catch your eye? Made you wonder if I accidentally pushed the wrong branch? or skewed something up big time? Well, nuh uh. I just happen to be fed up with the melee attack chain still using stringized params instead of an array/list. It was frankly revolting to see how I'd have had to otherwise call `list2params` for what I'm trying to accomplish here, and make this PR another tessera to the immense stupidity of our attack chain procs calling `params2list` over and over and over instead of just using that one call instance from `ClickOn` as an argument. It's 2025, honey, wake up! I also tried to replace some of those single letter vars/args but there are just way too many of them. Improving old code. And I want to be able to pet mobroaches while holding them too. 🆑 qol: You can now interact with held mobs in more ways beside wearing them. /🆑
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
/**
|
|
* # Pet bonus element!
|
|
*
|
|
* Bespoke element that plays a fun message, sends a heart out, and gives a stronger mood bonus when you pet this animal.
|
|
* I may have been able to make this work for carbons, but it would have been interjecting on some help mode interactions anyways.
|
|
*/
|
|
/datum/element/pet_bonus
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
|
|
///string key of the emote to do when pet.
|
|
var/emote_name
|
|
///actual moodlet given, defaults to the pet animal one
|
|
var/moodlet
|
|
|
|
/datum/element/pet_bonus/Attach(datum/target, emote_name, moodlet = /datum/mood_event/pet_animal)
|
|
. = ..()
|
|
if(!isliving(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
src.emote_name = emote_name
|
|
src.moodlet = moodlet
|
|
RegisterSignal(target, COMSIG_ATOM_ATTACK_HAND, PROC_REF(on_attack_hand))
|
|
|
|
/datum/element/pet_bonus/Detach(datum/target)
|
|
. = ..()
|
|
UnregisterSignal(target, COMSIG_ATOM_ATTACK_HAND)
|
|
|
|
/datum/element/pet_bonus/proc/on_attack_hand(mob/living/pet, mob/living/petter, list/modifiers)
|
|
SIGNAL_HANDLER
|
|
|
|
if(pet.stat != CONSCIOUS || petter.combat_mode || LAZYACCESS(modifiers, RIGHT_CLICK))
|
|
return
|
|
|
|
new /obj/effect/temp_visual/heart(get_turf(pet))
|
|
SEND_SIGNAL(pet, COMSIG_ANIMAL_PET, petter, modifiers)
|
|
if(emote_name && prob(33))
|
|
INVOKE_ASYNC(pet, TYPE_PROC_REF(/mob, emote), emote_name)
|
|
petter.add_mood_event("petting_bonus", moodlet, pet)
|