Kills /obj/item/melee/transforming, replaces it with a transforming weapon component (#60761)

This PR kills off the transforming subtype of /obj/item/melee and replaces it with a component to handle the transforming behavior, /datum/component/transforming.

The transforming component handles updating the variables of an item when it's transformed. Things like force, sharpness, whetstone force bonus, and attack verbs. Similar to the two-handed component, but instead of transforming into a two-hander it remains a one handed weapon.

The "nemesis" behavior (dealing addition damage to certain factions) of the transforming subtype was moved to the cleaving saw only, since it was the only transforming item that used it. In the future, this can be made into a bespoke element/component as well.

The following weapons and items have been updated to use this component:

    Energy Swords / Sabers / Bananium Energy Sword
    Energy Circular Saw
    Energy Dagger
    Energy Axe
    Toy Energy Sword
    Holographic Energy Sword
    Switchblade
    Advanced Medical Tools (Laser scalpel, Mechanical Pinches, Searing Tool)
    Advanced Engineering Tools (Hand Drill, Jaws of Life / Syndicate Jaws of Life)
    Combat Wrench
    Cleaving Saw
    Telescopic Batons / Contractor Batons
    Roasting Stick
    Telescopic Riot Shield
    Energy Shield / Bananium Energy Shield

This PR also touches up the code around the various above items.
This commit is contained in:
MrMelbert
2021-08-23 13:45:54 -05:00
committed by GitHub
parent d8a1f27fff
commit b3e8eebdc9
76 changed files with 1084 additions and 835 deletions
+41 -39
View File
@@ -122,6 +122,10 @@
desc = "It's an expensive [current_skin] fountain pen. The nib is quite sharp."
/obj/item/pen/attack_self(mob/living/carbon/user)
. = ..()
if(.)
return
var/deg = input(user, "What angle would you like to rotate the pen head to? (1-360)", "Rotate Pen Head") as null|num
if(deg && (deg > 0 && deg <= 360))
degrees = deg
@@ -216,62 +220,60 @@
/obj/item/pen/edagger
attack_verb_continuous = list("slashes", "stabs", "slices", "tears", "lacerates", "rips", "dices", "cuts") //these won't show up if the pen is off
attack_verb_simple = list("slash", "stab", "slice", "tear", "lacerate", "rip", "dice", "cut")
sharpness = SHARP_EDGED
var/on = FALSE
sharpness = SHARP_POINTY
/// The real name of our item when extended.
var/hidden_name = "energy dagger"
/// Whether or pen is extended
var/extended = FALSE
/obj/item/pen/edagger/ComponentInitialize()
/obj/item/pen/edagger/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 60, 100, 0, 'sound/weapons/blade1.ogg')
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/pen/edagger/get_sharpness()
return on * sharpness
AddComponent(/datum/component/butchering, _speed = 6 SECONDS, _butcher_sound = 'sound/weapons/blade1.ogg')
AddComponent(/datum/component/transforming, \
force_on = 18, \
throwforce_on = 35, \
throw_speed_on = 4, \
sharpness_on = SHARP_EDGED, \
w_class_on = WEIGHT_CLASS_NORMAL)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
/obj/item/pen/edagger/suicide_act(mob/user)
. = BRUTELOSS
if(on)
if(extended)
user.visible_message(span_suicide("[user] forcefully rams the pen into their mouth!"))
else
user.visible_message(span_suicide("[user] is holding a pen up to their mouth! It looks like [user.p_theyre()] trying to commit suicide!"))
attack_self(user)
/obj/item/pen/edagger/attack_self(mob/living/user)
if(on)
on = FALSE
force = initial(force)
throw_speed = initial(throw_speed)
w_class = initial(w_class)
name = initial(name)
hitsound = initial(hitsound)
embedding = list(embed_chance = EMBED_CHANCE)
throwforce = initial(throwforce)
playsound(user, 'sound/weapons/saberoff.ogg', 5, TRUE)
to_chat(user, span_warning("[src] can now be concealed."))
else
on = TRUE
force = 18
throw_speed = 4
w_class = WEIGHT_CLASS_NORMAL
name = "energy dagger"
hitsound = 'sound/weapons/blade1.ogg'
embedding = list(embed_chance = 100) //rule of cool
throwforce = 35
playsound(user, 'sound/weapons/saberon.ogg', 5, TRUE)
to_chat(user, span_warning("[src] is now active."))
updateEmbedding()
update_appearance()
/*
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
*
* Handles swapping their icon files to edagger related icon files -
* as they're supposed to look like a normal pen.
*/
/obj/item/pen/edagger/proc/on_transform(obj/item/source, mob/user, active)
SIGNAL_HANDLER
/obj/item/pen/edagger/update_icon_state()
if(on)
icon_state = inhand_icon_state = "edagger"
extended = active
if(active)
name = hidden_name
icon_state = "edagger"
inhand_icon_state = "edagger"
lefthand_file = 'icons/mob/inhands/weapons/swords_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/swords_righthand.dmi'
embedding = list(embed_chance = 100) // Rule of cool
else
icon_state = initial(icon_state) //looks like a normal pen when off.
name = initial(name)
icon_state = initial(icon_state)
inhand_icon_state = initial(inhand_icon_state)
lefthand_file = initial(lefthand_file)
righthand_file = initial(righthand_file)
return ..()
embedding = list(embed_chance = EMBED_CHANCE)
updateEmbedding()
balloon_alert(user, "[hidden_name] [active ? "active":"concealed"]")
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
return COMPONENT_NO_DEFAULT_MESSAGE
/obj/item/pen/survival
name = "survival pen"