mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 21:48:39 +01:00
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:
@@ -62,7 +62,7 @@
|
||||
/obj/item/crowbar/power
|
||||
name = "jaws of life"
|
||||
desc = "A set of jaws of life, compressed through the magic of science."
|
||||
icon_state = "jaws_pry"
|
||||
icon_state = "jaws"
|
||||
inhand_icon_state = "jawsoflife"
|
||||
worn_icon_state = "jawsoflife"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||
@@ -73,10 +73,33 @@
|
||||
toolspeed = 0.7
|
||||
force_opens = TRUE
|
||||
|
||||
/obj/item/crowbar/power/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
force_on = force, \
|
||||
throwforce_on = throwforce, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = w_class, \
|
||||
clumsy_check = FALSE)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
|
||||
|
||||
/*
|
||||
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
||||
*
|
||||
* Toggles between crowbar and wirecutters and gives feedback to the user.
|
||||
*/
|
||||
/obj/item/crowbar/power/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
tool_behaviour = (active ? TOOL_WIRECUTTER : TOOL_CROWBAR)
|
||||
balloon_alert(user, "attached [active ? "cutting" : "prying"]")
|
||||
playsound(user ? user : src, 'sound/items/change_jaws.ogg', 50, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/crowbar/power/syndicate
|
||||
name = "Syndicate jaws of life"
|
||||
desc = "A re-engineered copy of Nanotrasen's standard jaws of life. Can be used to force open airlocks in its crowbar configuration."
|
||||
icon_state = "jaws_pry_syndie"
|
||||
icon_state = "jaws_syndie"
|
||||
toolspeed = 0.5
|
||||
force_opens = TRUE
|
||||
|
||||
@@ -99,34 +122,6 @@
|
||||
playsound(loc, "desecration", 50, TRUE, -1)
|
||||
return (BRUTELOSS)
|
||||
|
||||
/obj/item/crowbar/power/attack_self(mob/user)
|
||||
playsound(get_turf(user), 'sound/items/change_jaws.ogg', 50, TRUE)
|
||||
if(tool_behaviour == TOOL_CROWBAR)
|
||||
tool_behaviour = TOOL_WIRECUTTER
|
||||
balloon_alert(user, "attached cutting jaws")
|
||||
usesound = 'sound/items/jaws_cut.ogg'
|
||||
update_appearance()
|
||||
|
||||
else
|
||||
tool_behaviour = TOOL_CROWBAR
|
||||
balloon_alert(user, "attached prying jaws")
|
||||
usesound = 'sound/items/jaws_pry.ogg'
|
||||
update_appearance()
|
||||
|
||||
/obj/item/crowbar/power/update_icon_state()
|
||||
if(tool_behaviour == TOOL_WIRECUTTER)
|
||||
icon_state = "jaws_cutter"
|
||||
else
|
||||
icon_state = "jaws_pry"
|
||||
return ..()
|
||||
|
||||
/obj/item/crowbar/power/syndicate/update_icon_state()
|
||||
if(tool_behaviour == TOOL_WIRECUTTER)
|
||||
icon_state = "jaws_cutter_syndie"
|
||||
else
|
||||
icon_state = "jaws_pry_syndie"
|
||||
return ..()
|
||||
|
||||
/obj/item/crowbar/power/attack(mob/living/carbon/C, mob/user)
|
||||
if(istype(C) && C.handcuffed && tool_behaviour == TOOL_WIRECUTTER)
|
||||
user.visible_message(span_notice("[user] cuts [C]'s restraints with [src]!"))
|
||||
|
||||
@@ -72,7 +72,8 @@
|
||||
/obj/item/screwdriver/power
|
||||
name = "hand drill"
|
||||
desc = "A simple powered hand drill."
|
||||
icon_state = "drill_screw"
|
||||
icon_state = "drill"
|
||||
belt_icon_state = null
|
||||
inhand_icon_state = "drill"
|
||||
worn_icon_state = "drill"
|
||||
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
|
||||
@@ -89,9 +90,34 @@
|
||||
usesound = 'sound/items/drill_use.ogg'
|
||||
toolspeed = 0.7
|
||||
random_color = FALSE
|
||||
greyscale_config = null
|
||||
greyscale_config_belt = null
|
||||
greyscale_config_inhand_left = null
|
||||
greyscale_config_inhand_right = null
|
||||
|
||||
/obj/item/screwdriver/power/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/transforming, \
|
||||
force_on = force, \
|
||||
throwforce_on = throwforce, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = w_class, \
|
||||
clumsy_check = FALSE)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
|
||||
|
||||
/*
|
||||
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
||||
*
|
||||
* Toggles between crowbar and wirecutters and gives feedback to the user.
|
||||
*/
|
||||
/obj/item/screwdriver/power/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
tool_behaviour = (active ? TOOL_WRENCH : TOOL_SCREWDRIVER)
|
||||
balloon_alert(user, "attached [active ? "bolt bit" : "screw bit"]")
|
||||
playsound(user ? user : src, 'sound/items/change_drill.ogg', 50, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
/obj/item/screwdriver/power/examine()
|
||||
. = ..()
|
||||
. += " It's fitted with a [tool_behaviour == TOOL_SCREWDRIVER ? "screw" : "bolt"] bit."
|
||||
@@ -104,17 +130,6 @@
|
||||
playsound(loc, 'sound/items/drill_use.ogg', 50, TRUE, -1)
|
||||
return(BRUTELOSS)
|
||||
|
||||
/obj/item/screwdriver/power/attack_self(mob/user)
|
||||
playsound(get_turf(user), 'sound/items/change_drill.ogg', 50, TRUE)
|
||||
if(tool_behaviour == TOOL_SCREWDRIVER)
|
||||
tool_behaviour = TOOL_WRENCH
|
||||
balloon_alert(user, "attached bolt bit")
|
||||
icon_state = "drill_bolt"
|
||||
else
|
||||
tool_behaviour = TOOL_SCREWDRIVER
|
||||
balloon_alert(user, "attached screw bit")
|
||||
icon_state = "drill_screw"
|
||||
|
||||
/obj/item/screwdriver/cyborg
|
||||
name = "automated screwdriver"
|
||||
desc = "A powerful automated screwdriver, designed to be both precise and quick."
|
||||
|
||||
@@ -82,43 +82,37 @@
|
||||
name = "combat wrench"
|
||||
desc = "It's like a normal wrench but edgier. Can be found on the battlefield."
|
||||
icon_state = "wrench_combat"
|
||||
inhand_icon_state = "wrench_combat"
|
||||
belt_icon_state = "wrench_combat"
|
||||
attack_verb_continuous = list("devastates", "brutalizes", "commits a war crime against", "obliterates", "humiliates")
|
||||
attack_verb_simple = list("devastate", "brutalize", "commit a war crime against", "obliterate", "humiliate")
|
||||
tool_behaviour = null
|
||||
toolspeed = null
|
||||
var/on = FALSE
|
||||
|
||||
/obj/item/wrench/combat/ComponentInitialize()
|
||||
/obj/item/wrench/combat/Initialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/update_icon_updates_onmob)
|
||||
AddComponent(/datum/component/transforming, \
|
||||
force_on = 6, \
|
||||
throwforce_on = 8, \
|
||||
hitsound_on = hitsound, \
|
||||
w_class_on = WEIGHT_CLASS_NORMAL, \
|
||||
clumsy_check = FALSE)
|
||||
RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, .proc/on_transform)
|
||||
|
||||
/obj/item/wrench/combat/attack_self(mob/living/user)
|
||||
if(on)
|
||||
on = FALSE
|
||||
force = initial(force)
|
||||
w_class = initial(w_class)
|
||||
throwforce = initial(throwforce)
|
||||
tool_behaviour = initial(tool_behaviour)
|
||||
toolspeed = initial(toolspeed)
|
||||
playsound(user, 'sound/weapons/saberoff.ogg', 5, TRUE)
|
||||
to_chat(user, span_warning("[src] can now be kept at bay."))
|
||||
else
|
||||
on = TRUE
|
||||
force = 6
|
||||
w_class = WEIGHT_CLASS_NORMAL
|
||||
throwforce = 8
|
||||
/*
|
||||
* Signal proc for [COMSIG_TRANSFORMING_ON_TRANSFORM].
|
||||
*
|
||||
* Gives it wrench behaviors when active.
|
||||
*/
|
||||
/obj/item/wrench/combat/proc/on_transform(obj/item/source, mob/user, active)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(active)
|
||||
tool_behaviour = TOOL_WRENCH
|
||||
toolspeed = 1
|
||||
playsound(user, 'sound/weapons/saberon.ogg', 5, TRUE)
|
||||
to_chat(user, span_warning("[src] is now active. Woe onto your enemies!"))
|
||||
update_appearance()
|
||||
|
||||
/obj/item/wrench/combat/update_icon_state()
|
||||
if(on)
|
||||
icon_state = "[initial(icon_state)]_on"
|
||||
inhand_icon_state = "[initial(inhand_icon_state)]1"
|
||||
else
|
||||
icon_state = "[initial(icon_state)]"
|
||||
inhand_icon_state = "[initial(inhand_icon_state)]"
|
||||
return ..()
|
||||
tool_behaviour = initial(tool_behaviour)
|
||||
toolspeed = initial(toolspeed)
|
||||
|
||||
balloon_alert(user, "[name] [active ? "active, woe!":"restrained"]")
|
||||
playsound(user ? user : src, active ? 'sound/weapons/saberon.ogg' : 'sound/weapons/saberoff.ogg', 5, TRUE)
|
||||
return COMPONENT_NO_DEFAULT_MESSAGE
|
||||
|
||||
Reference in New Issue
Block a user