From 57de0bf71ec0cee0b0add36207f4df4be712d0b8 Mon Sep 17 00:00:00 2001 From: FalloutFalcon Date: Mon, 30 Sep 2024 11:00:50 -0500 Subject: [PATCH] tweaks to two handed stuff to make it more maintaiable --- .../items/melee/{fireaxe.dm => axe.dm} | 9 +++--- code/game/objects/items/melee/energy.dm | 17 +++------- code/game/objects/items/melee/spear.dm | 31 ++++--------------- .../melee/{transforming.dm => trickweapon.dm} | 0 shiptest.dme | 4 +-- 5 files changed, 17 insertions(+), 44 deletions(-) rename code/game/objects/items/melee/{fireaxe.dm => axe.dm} (89%) rename code/game/objects/items/melee/{transforming.dm => trickweapon.dm} (100%) diff --git a/code/game/objects/items/melee/fireaxe.dm b/code/game/objects/items/melee/axe.dm similarity index 89% rename from code/game/objects/items/melee/fireaxe.dm rename to code/game/objects/items/melee/axe.dm index d935c66c2cf7..472b37eff354 100644 --- a/code/game/objects/items/melee/fireaxe.dm +++ b/code/game/objects/items/melee/axe.dm @@ -14,6 +14,7 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 30) resistance_flags = FIRE_PROOF species_exception = list(/datum/species/kepori) + var/force_wielded = 25 var/wielded = FALSE // track wielded status on item /obj/item/melee/axe/Initialize() @@ -24,7 +25,7 @@ /obj/item/melee/axe/ComponentInitialize() . = ..() AddComponent(/datum/component/butchering, 100, 80, 0 , hitsound) //axes are not known for being precision butchering tools - AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=30, icon_wielded="[base_icon_state]_w") + AddComponent(/datum/component/two_handed, force_unwielded = force, force_wielded = force_wielded, icon_wielded="[base_icon_state]_w") /// triggered on wield of two handed item /obj/item/melee/axe/proc/on_wield(obj/item/source, mob/user) @@ -56,6 +57,7 @@ desc = "Truly, the weapon of a madman. Who would think to fight fire with an axe?" icon_state = "fireaxe" base_icon_state = "fireaxe" + force_wielded = 30 /obj/item/melee/axe/bone // Blatant imitation of the fireaxe, but made out of bone. name = "bone axe" @@ -66,8 +68,5 @@ /obj/item/melee/axe/scrap name = "scrap axe" desc = "Oversided and with a pretty dull blade, its decent against armour" + force_wielded = 22 armour_penetration = 10 - -/obj/item/melee/axe/scrap/ComponentInitialize() - . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=5, force_wielded=22, icon_wielded="[base_icon_state]_w") diff --git a/code/game/objects/items/melee/energy.dm b/code/game/objects/items/melee/energy.dm index cf9ccc625bc3..1985c3d7ebfa 100644 --- a/code/game/objects/items/melee/energy.dm +++ b/code/game/objects/items/melee/energy.dm @@ -3,7 +3,6 @@ w_class = WEIGHT_CLASS_SMALL attack_verb = list("attacked", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") icon = 'icons/obj/weapon/energy.dmi' - active_hitsound = 'sound/weapons/blade1.ogg' heat = 0 max_integrity = 200 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 30) @@ -31,17 +30,6 @@ /obj/item/melee/energy/Initialize(mapload) . = ..() - make_transformable() - AddElement(/datum/element/update_icon_updates_onmob) - if(sharpness) - AddComponent(/datum/component/butchering, 50, 100, 0, hitsound) - if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE)) - START_PROCESSING(SSobj, src) - -/* - * Gives our item the transforming component, passing in our various vars. - */ -/obj/item/melee/energy/proc/make_transformable() AddComponent( \ /datum/component/transforming, \ force_on = active_force, \ @@ -53,6 +41,11 @@ attack_verb_on = attack_verb_on, \ ) RegisterSignal(src, COMSIG_TRANSFORMING_ON_TRANSFORM, PROC_REF(on_transform)) + AddElement(/datum/element/update_icon_updates_onmob) + if(sharpness) + AddComponent(/datum/component/butchering, 50, 100, 0, hitsound) + if(HAS_TRAIT(src, TRAIT_TRANSFORM_ACTIVE)) + START_PROCESSING(SSobj, src) /obj/item/melee/energy/Destroy() STOP_PROCESSING(SSobj, src) diff --git a/code/game/objects/items/melee/spear.dm b/code/game/objects/items/melee/spear.dm index ddf4314d6efc..0e40eff21684 100644 --- a/code/game/objects/items/melee/spear.dm +++ b/code/game/objects/items/melee/spear.dm @@ -21,12 +21,13 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30) species_exception = list(/datum/species/kepori) var/icon_prefix = "spearglass" + var/force_wielded = 18 /obj/item/melee/spear/ComponentInitialize() . = ..() AddComponent(/datum/component/butchering, 100, 70) //decent in a pinch, but pretty bad. AddComponent(/datum/component/jousting) - AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=18, icon_wielded="[icon_prefix]_w") + AddComponent(/datum/component/two_handed, force_unwielded = force, force_wielded = force_wielded, icon_wielded = "[icon_prefix]_w") /obj/item/melee/spear/update_icon_state() icon_state = "[icon_prefix]" @@ -36,8 +37,9 @@ var/obj/item/shard/tip = locate() in parts_list if (istype(tip, /obj/item/shard/plasma)) throwforce = 21 + force_wielded = 19 icon_prefix = "spearplasma" - AddComponent(/datum/component/two_handed, force_unwielded=11, force_wielded=19, icon_wielded="[icon_prefix]_w") + AddComponent(/datum/component/two_handed, force_unwielded = force, force_wielded = force_wielded, icon_wielded = "[icon_prefix]_w") update_appearance() qdel(tip) ..() @@ -53,11 +55,8 @@ desc = "A haphazardly-constructed yet still deadly weapon. The pinnacle of modern technology." //this should be a plasma spear or worse. force = 11 - throwforce = 21 - -/obj/item/melee/spear/bone/ComponentInitialize() - . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=11, force_wielded=19, icon_wielded="[icon_prefix]_w") + throwforce = 19 + force_wielded = 17 /obj/item/melee/spear/explosive name = "explosive lance" @@ -70,26 +69,8 @@ /obj/item/melee/spear/explosive/Initialize(mapload) . = ..() - RegisterSignal(src, COMSIG_TWOHANDED_WIELD, PROC_REF(on_wield)) - RegisterSignal(src, COMSIG_TWOHANDED_UNWIELD, PROC_REF(on_unwield)) set_explosive(new /obj/item/grenade/iedcasing/spawned()) //For admin-spawned explosive lances -/obj/item/melee/spear/explosive/ComponentInitialize() - . = ..() - AddComponent(/datum/component/two_handed, force_unwielded=10, force_wielded=18, icon_wielded="[icon_prefix]_w") - -/// triggered on wield of two handed item -/obj/item/melee/spear/explosive/proc/on_wield(obj/item/source, mob/user) - SIGNAL_HANDLER - - wielded = TRUE - -/// triggered on unwield of two handed item -/obj/item/melee/spear/explosive/proc/on_unwield(obj/item/source, mob/user) - SIGNAL_HANDLER - - wielded = FALSE - /obj/item/melee/spear/explosive/proc/set_explosive(obj/item/grenade/G) if(explosive) QDEL_NULL(explosive) diff --git a/code/game/objects/items/melee/transforming.dm b/code/game/objects/items/melee/trickweapon.dm similarity index 100% rename from code/game/objects/items/melee/transforming.dm rename to code/game/objects/items/melee/trickweapon.dm diff --git a/shiptest.dme b/shiptest.dme index a4ff20a2d2a7..9dcece1b986a 100644 --- a/shiptest.dme +++ b/shiptest.dme @@ -1315,12 +1315,12 @@ #include "code\game\objects\items\implants\implanter.dm" #include "code\game\objects\items\implants\implantpad.dm" #include "code\game\objects\items\implants\implantuplink.dm" +#include "code\game\objects\items\melee\axe.dm" #include "code\game\objects\items\melee\bladeatheon.dm" #include "code\game\objects\items\melee\chainsaw.dm" #include "code\game\objects\items\melee\dualsaber.dm" #include "code\game\objects\items\melee\energy.dm" #include "code\game\objects\items\melee\energyhalberd.dm" -#include "code\game\objects\items\melee\fireaxe.dm" #include "code\game\objects\items\melee\knife.dm" #include "code\game\objects\items\melee\misc.dm" #include "code\game\objects\items\melee\powerfist.dm" @@ -1328,7 +1328,7 @@ #include "code\game\objects\items\melee\stunbaton.dm" #include "code\game\objects\items\melee\sword.dm" #include "code\game\objects\items\melee\teleprod.dm" -#include "code\game\objects\items\melee\transforming.dm" +#include "code\game\objects\items\melee\trickweapon.dm" #include "code\game\objects\items\melee\weaponry.dm" #include "code\game\objects\items\robot\ai_upgrades.dm" #include "code\game\objects\items\robot\robot_items.dm"