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 11:45:54 -07:00
committed by GitHub
parent d8a1f27fff
commit b3e8eebdc9
76 changed files with 1084 additions and 835 deletions
@@ -59,65 +59,65 @@
//BANANIUM SWORD
/obj/item/melee/transforming/energy/sword/bananium
/obj/item/melee/energy/sword/bananium
name = "bananium sword"
desc = "An elegant weapon, for a more civilized age."
icon_state = "e_sword"
attack_verb_continuous = list("hits", "taps", "pokes")
attack_verb_simple = list("hit", "tap", "poke")
force = 0
throwforce = 0
force_on = 0
throwforce_on = 0
hitsound = null
attack_verb_on = list("slips")
clumsy_check = FALSE
sharpness = NONE
sword_color = "yellow"
heat = 0
embedding = null
light_color = COLOR_YELLOW
var/next_trombone_allowed = 0
sword_color_icon = "bananium"
active_heat = 0
/// Cooldown for making a trombone noise for failing to make a bananium desword
COOLDOWN_DECLARE(next_trombone_allowed)
/obj/item/melee/transforming/energy/sword/bananium/Initialize()
/obj/item/melee/energy/sword/bananium/make_transformable()
AddComponent(/datum/component/transforming, \
throw_speed_on = 4, \
attack_verb_continuous_on = list("slips"), \
attack_verb_simple_on = list("slip"), \
clumsy_check = FALSE)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
/obj/item/melee/energy/sword/bananium/on_transform(obj/item/source, mob/user, active)
. = ..()
adjust_slipperiness()
/* Adds or removes a slippery component, depending on whether the sword
* is active or not.
/*
* Adds or removes a slippery component, depending on whether the sword is active or not.
*/
/obj/item/melee/transforming/energy/sword/proc/adjust_slipperiness()
if(active)
/obj/item/melee/energy/sword/bananium/proc/adjust_slipperiness()
if(blade_active)
AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP)
else
qdel(GetComponent(/datum/component/slippery))
/obj/item/melee/transforming/energy/sword/bananium/attack(mob/living/M, mob/living/user)
..()
if(active)
/obj/item/melee/energy/sword/bananium/attack(mob/living/M, mob/living/user)
. = ..()
if(blade_active)
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)
slipper.Slip(src, M)
/obj/item/melee/transforming/energy/sword/bananium/throw_impact(atom/hit_atom, throwingdatum)
/obj/item/melee/energy/sword/bananium/throw_impact(atom/hit_atom, throwingdatum)
. = ..()
if(active)
if(blade_active)
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)
slipper.Slip(src, hit_atom)
/obj/item/melee/transforming/energy/sword/bananium/attackby(obj/item/I, mob/living/user, params)
if((world.time > next_trombone_allowed) && istype(I, /obj/item/melee/transforming/energy/sword/bananium))
next_trombone_allowed = world.time + 50
/obj/item/melee/energy/sword/bananium/attackby(obj/item/weapon, mob/living/user, params)
if(COOLDOWN_FINISHED(src, next_trombone_allowed) && istype(weapon, /obj/item/melee/energy/sword/bananium))
COOLDOWN_START(src, next_trombone_allowed, 5 SECONDS)
to_chat(user, span_warning("You slap the two swords together. Sadly, they do not seem to fit!"))
playsound(src, 'sound/misc/sadtrombone.ogg', 50)
return TRUE
return ..()
/obj/item/melee/transforming/energy/sword/bananium/transform_weapon(mob/living/user, supress_message_text)
. = ..()
adjust_slipperiness()
/obj/item/melee/transforming/energy/sword/bananium/ignition_effect(atom/A, mob/user)
return ""
/obj/item/melee/transforming/energy/sword/bananium/suicide_act(mob/user)
if(!active)
transform_weapon(user, TRUE)
/obj/item/melee/energy/sword/bananium/suicide_act(mob/user)
if(!blade_active)
attack_self(user)
user.visible_message(span_suicide("[user] is [pick("slitting [user.p_their()] stomach open with", "falling on")] [src]! It looks like [user.p_theyre()] trying to commit seppuku, but the blade slips off of [user.p_them()] harmlessly!"))
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)
slipper.Slip(src, user)
@@ -128,42 +128,39 @@
/obj/item/shield/energy/bananium
name = "bananium energy shield"
desc = "A shield that stops most melee attacks, protects user from almost all energy projectiles, and can be thrown to slip opponents."
icon_state = "bananaeshield"
throw_speed = 1
clumsy_check = 0
base_icon_state = "bananaeshield"
force = 0
throwforce = 0
throw_range = 5
on_force = 0
on_throwforce = 0
on_throw_speed = 1
/obj/item/shield/energy/bananium/Initialize()
active_force = 0
active_throwforce = 0
active_throw_speed = 1
can_clumsy_use = TRUE
/obj/item/shield/energy/bananium/on_transform(obj/item/source, mob/user, active)
. = ..()
adjust_slipperiness()
/* Adds or removes a slippery component, depending on whether the shield
* is active or not.
/*
* Adds or removes a slippery component, depending on whether the shield is active or not.
*/
/obj/item/shield/energy/bananium/proc/adjust_slipperiness()
if(active)
if(enabled)
AddComponent(/datum/component/slippery, 60, GALOSHES_DONT_HELP)
else
qdel(GetComponent(/datum/component/slippery))
/obj/item/shield/energy/bananium/attack_self(mob/living/carbon/human/user)
. = ..()
adjust_slipperiness()
/obj/item/shield/energy/bananium/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force, gentle = FALSE, quickstart = TRUE)
if(active)
if(enabled)
if(iscarbon(thrower))
var/mob/living/carbon/C = thrower
C.throw_mode_on(THROW_MODE_TOGGLE) //so they can catch it on the return.
return ..()
/obj/item/shield/energy/bananium/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
if(active)
if(enabled)
var/caught = hit_atom.hitby(src, FALSE, FALSE, throwingdatum=throwingdatum)
if(iscarbon(hit_atom) && !caught)//if they are a carbon and they didn't catch it
var/datum/component/slippery/slipper = GetComponent(/datum/component/slippery)