[MIRROR] Removes some boilerplate from transforming component [MDB IGNORE] (#21885)

* Removes some boilerplate from transforming component

* conflicts

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-06-19 23:14:10 +02:00
committed by GitHub
parent bd79490ccf
commit 4a451d4e24
20 changed files with 197 additions and 186 deletions
+11 -11
View File
@@ -848,8 +848,6 @@
hitsound = 'sound/weapons/bladeslice.ogg'
w_class = WEIGHT_CLASS_BULKY
sharpness = SHARP_EDGED
/// Whether the saw is open or not
var/is_open = FALSE
/// List of factions we deal bonus damage to
var/list/nemesis_factions = list(FACTION_MINING, FACTION_BOSS)
/// Amount of damage we deal to the above factions
@@ -865,7 +863,8 @@
/obj/item/melee/cleaving_saw/Initialize(mapload)
. = ..()
AddComponent(/datum/component/transforming, \
AddComponent( \
/datum/component/transforming, \
transform_cooldown_time = (CLICK_CD_MELEE * 0.25), \
force_on = open_force, \
throwforce_on = open_throwforce, \
@@ -873,26 +872,28 @@
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"))
attack_verb_simple_on = list("cleave", "swipe", "slash", "chop"), \
)
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform))
/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("It is [HAS_TRAIT(src, TRAIT_TRANSFORM_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"].")
. += 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/living/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!"))
user.visible_message(span_suicide("[user] is [HAS_TRAIT(src, TRAIT_TRANSFORM_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!"))
attack_self(user)
return BRUTELOSS
/obj/item/melee/cleaving_saw/melee_attack_chain(mob/user, atom/target, params)
. = ..()
if(!is_open)
if(!HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE))
user.changeNext_move(CLICK_CD_MELEE * 0.5) //when closed, it attacks very rapidly
/obj/item/melee/cleaving_saw/attack(mob/living/target, mob/living/carbon/human/user)
var/is_open = HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE)
if(!is_open || swiping || !target.density || get_turf(target) == get_turf(user))
if(!is_open)
faction_bonus_force = 0
@@ -943,11 +944,10 @@
/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))
if(user)
balloon_alert(user, "[active ? "opened" : "closed"] [src]")
playsound(src, 'sound/magic/clockwork/fellowship_armory.ogg', 35, TRUE, frequency = 90000 - (active * 30000))
return COMPONENT_NO_DEFAULT_MESSAGE
//Legion: Staff of Storms