Files
Bubberstation/code/modules/vehicles/vehicle_key.dm
T
f4e244fb49 [MIRROR] Refactors embedding to use datums instead of storing data in bespoke elements (#28699)
* Refactors embedding to use datums instead of storing data in bespoke elements (#84599)

## About The Pull Request

This refactors embedding elements to make them use singleton datums
(similarly to armor) instead being bespoke and creating a new element
every time armor values are supposed to be adjusted.
Default values have been removed from defines due to now being declared
in base class itself.
Additionally fixes vending machines and tackling gloves setting
generated shards (which they instantly embed into their victim) embed
properties to null after running the embedding code, despite said shards
having non-null embedding values by default, making them not be able to
embed into anyone else, also potentially breaking the pain/jostling code
if they somehow get updated.

## Why It's Good For The Game

Current embedding system is an unnecessarily complicated mess as bespoke
elements are hard to work with, and creating a new element every time
you change values is hacky at best. This change should make it easier to
read and work with.

## Changelog
🆑
fix: Fixed glass shards generated from falling vending machines or
tackling windows not being able to embed into anyone.
refactor: Refactored embedding code to use datums instead of bespoke
elements and ugly associated lists.
/🆑

* Refactors embedding to use datums instead of storing data in bespoke elements

* modular fixes

* fix c14

* paint -> pain ugggh

---------

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
2024-07-08 14:50:05 +05:30

95 lines
5.0 KiB
Plaintext

/obj/item/key
name = "key"
desc = "A small grey key."
icon = 'icons/mob/rideables/vehicles.dmi'
icon_state = "key"
w_class = WEIGHT_CLASS_TINY
/obj/item/key/atv
name = "ATV key"
desc = "A small grey key for starting and operating ATVs."
/obj/item/key/security
desc = "A keyring with a small steel key, and a rubber stun baton accessory."
icon_state = "keysec"
/obj/item/key/security/suicide_act(mob/living/carbon/user)
if(!user.emote("spin")) //In the off chance that someone attempts this suicide while under the effects of mime's bane they deserve the silliness.
user.visible_message(span_suicide("[user] is putting \the [src] in [user.p_their()] ear and starts [user.p_their()] motor! It looks like [user.p_theyre()] trying to commit suicide... But [user.p_they()] sputters and stalls out! "))
playsound(src, 'sound/misc/sadtrombone.ogg', 50, TRUE, -1)
return SHAME
user.visible_message(span_suicide("[user] is putting \the [src] in [user.p_their()] ear and starts [user.p_their()] motor! It looks like [user.p_theyre()] trying to commit suicide!"))
user.say("Vroom vroom!!", forced="secway key suicide") //Not doing a shamestate here, because even if they fail to speak they're spinning.
addtimer(CALLBACK(user, TYPE_PROC_REF(/mob/living/, gib)), 2 SECONDS)
return MANUAL_SUICIDE
/obj/item/key/janitor
desc = "A keyring with a small steel key, and a pink fob reading \"Pussy Wagon\"."
icon_state = "keyjanitor"
force = 2
w_class = WEIGHT_CLASS_SMALL
throwforce = 9
hitsound = SFX_SWING_HIT
attack_verb_continuous = list("stubs", "pokes")
attack_verb_simple = list("stub", "poke")
sharpness = SHARP_EDGED
embed_type = /datum/embed_data/janicart_key
wound_bonus = -1
bare_wound_bonus = 2
/datum/embed_data/janicart_key
pain_mult = 1
embed_chance = 30
fall_chance = 70
/obj/item/key/janitor/suicide_act(mob/living/carbon/user)
switch(user.mind?.get_skill_level(/datum/skill/cleaning))
if(SKILL_LEVEL_NONE to SKILL_LEVEL_NOVICE) //Their mind is too weak to ascend as a janny
user.visible_message(span_suicide("[user] is putting \the [src] in [user.p_their()] mouth and is trying to become one with the janicart, but has no idea where to start! It looks like [user.p_theyre()] trying to commit suicide!"))
user.gib(DROP_ALL_REMAINS)
return MANUAL_SUICIDE
if(SKILL_LEVEL_APPRENTICE to SKILL_LEVEL_JOURNEYMAN) //At least they tried
user.visible_message(span_suicide("[user] is putting \the [src] in [user.p_their()] mouth and has inefficiently become one with the janicart! It looks like [user.p_theyre()] trying to commit suicide!"))
user.AddElement(/datum/element/cleaning)
addtimer(CALLBACK(src, PROC_REF(manual_suicide), user), 5.1 SECONDS)
return MANUAL_SUICIDE
if(SKILL_LEVEL_EXPERT to SKILL_LEVEL_MASTER) //They are worthy enough, but can it go even further beyond?
user.visible_message(span_suicide("[user] is putting \the [src] in [user.p_their()] mouth and has skillfully become one with the janicart! It looks like [user.p_theyre()] trying to commit suicide!"))
user.AddElement(/datum/element/cleaning)
for(var/i in 1 to 100)
addtimer(CALLBACK(user, TYPE_PROC_REF(/atom, add_atom_colour), (i % 2)? "#a245bb" : "#7a7d82", ADMIN_COLOUR_PRIORITY), i)
addtimer(CALLBACK(src, PROC_REF(manual_suicide), user), 101)
return MANUAL_SUICIDE
if(SKILL_LEVEL_LEGENDARY to INFINITY) //Holy shit, look at that janny go!
user.visible_message(span_suicide("[user] is putting \the [src] in [user.p_their()] mouth and has epically become one with the janicart, and they're even in overdrive mode! It looks like [user.p_theyre()] trying to commit suicide!"))
user.AddElement(/datum/element/cleaning)
playsound(src, 'sound//magic/lightning_chargeup.ogg', 50, TRUE, -1)
user.reagents.add_reagent(/datum/reagent/drug/methamphetamine, 10) //Gotta go fast!
for(var/i in 1 to 150)
addtimer(CALLBACK(user, TYPE_PROC_REF(/atom, add_atom_colour), (i % 2)? "#a245bb" : "#7a7d82", ADMIN_COLOUR_PRIORITY), i)
addtimer(CALLBACK(src, PROC_REF(manual_suicide), user), 151)
return MANUAL_SUICIDE
/obj/item/key/proc/manual_suicide(mob/living/user)
if(user)
user.remove_atom_colour(ADMIN_COLOUR_PRIORITY)
user.visible_message(span_suicide("[user] forgot [user.p_they()] isn't actually a janicart! That's a paddlin'!"))
if(user.mind?.get_skill_level(/datum/skill/cleaning) >= SKILL_LEVEL_LEGENDARY) //Janny janny janny janny janny
playsound(src, 'sound/effects/adminhelp.ogg', 50, TRUE, -1)
user.adjustOxyLoss(200)
user.death(FALSE)
/obj/item/key/lasso
name = "bone lasso"
desc = "The perfect tool for directing a Goliath! If only it made them move any faster..."
force = 12
icon_state = "lasso"
inhand_icon_state = "chain"
worn_icon_state = "whip"
lefthand_file = 'icons/mob/inhands/weapons/melee_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/melee_righthand.dmi'
attack_verb_continuous = list("flogs", "whips", "lashes", "disciplines")
attack_verb_simple = list("flog", "whip", "lash", "discipline")
hitsound = 'sound/weapons/whip.ogg'
slot_flags = ITEM_SLOT_BELT