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
+1 -1
View File
@@ -196,7 +196,7 @@
if(88)
new /obj/item/reagent_containers/food/drinks/bottle/lizardwine(src)
if(89)
new /obj/item/melee/transforming/energy/sword/bananium(src)
new /obj/item/melee/energy/sword/bananium(src)
if(90)
new /obj/item/dnainjector/wackymut(src)
if(91)
+86 -60
View File
@@ -795,88 +795,84 @@
//Blood-Drunk Miner: Cleaving Saw
/obj/item/melee/transforming/cleaving_saw
/obj/item/melee/cleaving_saw
name = "cleaving saw"
desc = "This saw, effective at drawing the blood of beasts, transforms into a long cleaver that makes use of centrifugal force."
force = 12
force_on = 20 //force when active
throwforce = 20
throwforce_on = 20
icon = 'icons/obj/lavaland/artefacts.dmi'
lefthand_file = 'icons/mob/inhands/64x64_lefthand.dmi'
righthand_file = 'icons/mob/inhands/64x64_righthand.dmi'
icon_state = "cleaving_saw"
worn_icon_state = "cleaving_saw"
attack_verb_continuous = list("attacks", "saws", "slices", "tears", "lacerates", "rips", "dices", "cuts")
attack_verb_simple = list("attack", "saw", "slice", "tear", "lacerate", "rip", "dice", "cut")
force = 12
throwforce = 20
inhand_x_dimension = 64
inhand_y_dimension = 64
icon_state = "cleaving_saw"
icon_state_on = "cleaving_saw_open"
worn_icon_state = "cleaving_saw"
slot_flags = ITEM_SLOT_BELT
attack_verb_off = list("attacks", "saws", "slices", "tears", "lacerates", "rips", "dices", "cuts")
attack_verb_on = list("cleaves", "swipes", "slashes", "chops")
hitsound = 'sound/weapons/bladeslice.ogg'
hitsound_on = 'sound/weapons/bladeslice.ogg'
w_class = WEIGHT_CLASS_BULKY
sharpness = SHARP_EDGED
faction_bonus_force = 30
nemesis_factions = list("mining", "boss")
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
var/transform_cooldown
/// Whether the saw is open or not
var/is_open = FALSE
/// List of factions we deal bonus damage to
var/list/nemesis_factions = list("mining", "boss")
/// Amount of damage we deal to the above factions
var/faction_bonus_force = 30
/// Whether the cleaver is actively AoE swiping something.
var/swiping = FALSE
/// Amount of bleed stacks gained per hit
var/bleed_stacks_per_hit = 3
/// Force when the saw is opened.
var/open_force = 20
/// Throwforce when the saw is opened.
var/open_throwforce = 20
/obj/item/melee/transforming/cleaving_saw/examine(mob/user)
/obj/item/melee/cleaving_saw/Initialize()
. = ..()
. += "<span class='notice'>It is [active ? "open, will cleave enemies in a wide arc and deal additional damage to fauna":"closed, and can be used for rapid consecutive attacks that cause fauna to bleed"].\n"+\
"Both modes will build up existing bleed effects, doing a burst of high damage if the bleed is built up high enough.\n"+\
"Transforming it immediately after an attack causes the next attack to come out faster.</span>"
AddComponent(/datum/component/transforming, \
transform_cooldown_time = (CLICK_CD_MELEE * 0.25), \
force_on = open_force, \
throwforce_on = open_throwforce, \
sharpness_on = sharpness, \
hitsound_on = hitsound, \
w_class_on = w_class, \
attack_verb_continuous_on = list("cleaves", "swipes", "slashes", "chops"), \
attack_verb_simple_on = list("cleave", "swipe", "slash", "chop"))
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
/obj/item/melee/transforming/cleaving_saw/suicide_act(mob/user)
user.visible_message(span_suicide("[user] is [active ? "closing [src] on [user.p_their()] neck" : "opening [src] into [user.p_their()] chest"]! It looks like [user.p_theyre()] trying to commit suicide!"))
transform_cooldown = 0
transform_weapon(user, TRUE)
/obj/item/melee/cleaving_saw/examine(mob/user)
. = ..()
. += span_notice("It is [is_open ? "open, will cleave enemies in a wide arc and deal additional damage to fauna":"closed, and can be used for rapid consecutive attacks that cause fauna to bleed"].")
. += span_notice("Both modes will build up existing bleed effects, doing a burst of high damage if the bleed is built up high enough.")
. += span_notice("Transforming it immediately after an attack causes the next attack to come out faster.")
/obj/item/melee/cleaving_saw/suicide_act(mob/user)
user.visible_message(span_suicide("[user] is [is_open ? "closing [src] on [user.p_their()] neck" : "opening [src] into [user.p_their()] chest"]! It looks like [user.p_theyre()] trying to commit suicide!"))
attack_self(user)
return BRUTELOSS
/obj/item/melee/transforming/cleaving_saw/transform_weapon(mob/living/user, supress_message_text)
if(transform_cooldown > world.time)
return FALSE
/obj/item/melee/cleaving_saw/melee_attack_chain(mob/user, atom/target, params)
. = ..()
if(.)
transform_cooldown = world.time + (CLICK_CD_MELEE * 0.5)
user.changeNext_move(CLICK_CD_MELEE * 0.25)
/obj/item/melee/transforming/cleaving_saw/transform_messages(mob/living/user, supress_message_text)
if(!supress_message_text)
if(active)
to_chat(user, span_notice("You open [src]. It will now cleave enemies in a wide arc and deal additional damage to fauna."))
else
to_chat(user, span_notice("You close [src]. It will now attack rapidly and cause fauna to bleed."))
playsound(user, 'sound/magic/clockwork/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (active * 30000))
/obj/item/melee/transforming/cleaving_saw/clumsy_transform_effect(mob/living/user)
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
to_chat(user, span_warning("You accidentally cut yourself with [src], like a doofus!"))
user.take_bodypart_damage(10)
/obj/item/melee/transforming/cleaving_saw/melee_attack_chain(mob/user, atom/target, params)
..()
if(!active)
if(!is_open)
user.changeNext_move(CLICK_CD_MELEE * 0.5) //when closed, it attacks very rapidly
/obj/item/melee/transforming/cleaving_saw/nemesis_effects(mob/living/user, mob/living/target)
if(istype(target, /mob/living/simple_animal/hostile/asteroid/elite))
return
var/datum/status_effect/stacking/saw_bleed/B = target.has_status_effect(STATUS_EFFECT_SAWBLEED)
if(!B)
target.apply_status_effect(STATUS_EFFECT_SAWBLEED,bleed_stacks_per_hit)
else
B.add_stacks(bleed_stacks_per_hit)
/obj/item/melee/transforming/cleaving_saw/attack(mob/living/target, mob/living/carbon/human/user)
if(!active || swiping || !target.density || get_turf(target) == get_turf(user))
if(!active)
/obj/item/melee/cleaving_saw/attack(mob/living/target, mob/living/carbon/human/user)
if(!is_open || swiping || !target.density || get_turf(target) == get_turf(user))
if(!is_open)
faction_bonus_force = 0
..()
if(!active)
var/is_nemesis_faction = FALSE
for(var/found_faction in target.faction)
if(found_faction in nemesis_factions)
is_nemesis_faction = TRUE
force += faction_bonus_force
nemesis_effects(user, target)
break
. = ..()
if(is_nemesis_faction)
force -= faction_bonus_force
if(!is_open)
faction_bonus_force = initial(faction_bonus_force)
else
var/turf/user_turf = get_turf(user)
@@ -890,6 +886,36 @@
melee_attack_chain(user, living_target)
swiping = FALSE
/*
* If we're attacking [target]s in our nemesis list, apply unique effects.
*
* user - the mob attacking with the saw
* target - the mob being attacked
*/
/obj/item/melee/cleaving_saw/proc/nemesis_effects(mob/living/user, mob/living/target)
if(istype(target, /mob/living/simple_animal/hostile/asteroid/elite))
return
var/datum/status_effect/stacking/saw_bleed/existing_bleed = target.has_status_effect(STATUS_EFFECT_SAWBLEED)
if(existing_bleed)
existing_bleed.add_stacks(bleed_stacks_per_hit)
else
target.apply_status_effect(STATUS_EFFECT_SAWBLEED, bleed_stacks_per_hit)
/*
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
*
* Gives feedback and makes the nextmove after transforming much quicker.
*/
/obj/item/melee/cleaving_saw/proc/on_transform(obj/item/source, mob/user, active)
SIGNAL_HANDLER
is_open = active
user.changeNext_move(CLICK_CD_MELEE * 0.25)
balloon_alert(user, "[active ? "opened":"closed"] [src]")
playsound(user ? user : src, 'sound/magic/clockwork/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (is_open * 30000))
return COMPONENT_NO_DEFAULT_MESSAGE
//Legion: Staff of Storms
/obj/item/storm_staff
+1 -1
View File
@@ -591,7 +591,7 @@
armor = list(MELEE = 30, BULLET = 30, LASER = 10, ENERGY = 20, BOMB = 50, BIO = 100, RAD = 10, FIRE = 100, ACID = 100)
max_heat_protection_temperature = FIRE_IMMUNITY_MAX_TEMP_PROTECT
resistance_flags = FIRE_PROOF
allowed = list(/obj/item/flashlight, /obj/item/tank/internals, /obj/item/pickaxe, /obj/item/spear, /obj/item/organ/regenerative_core/legion, /obj/item/kitchen/knife, /obj/item/kinetic_crusher, /obj/item/resonator, /obj/item/melee/transforming/cleaving_saw)
allowed = list(/obj/item/flashlight, /obj/item/tank/internals, /obj/item/pickaxe, /obj/item/spear, /obj/item/organ/regenerative_core/legion, /obj/item/kitchen/knife, /obj/item/kinetic_crusher, /obj/item/resonator, /obj/item/melee/cleaving_saw)
/obj/item/clothing/suit/space/hardsuit/berserker/Initialize()