Skip to content

Commit

Permalink
tweaks to two handed stuff to make it more maintaiable
Browse files Browse the repository at this point in the history
  • Loading branch information
FalloutFalcon committed Sep 30, 2024
1 parent 21cf5f0 commit 57de0bf
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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")
17 changes: 5 additions & 12 deletions code/game/objects/items/melee/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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, \
Expand All @@ -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)
Expand Down
31 changes: 6 additions & 25 deletions code/game/objects/items/melee/spear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand All @@ -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)
..()
Expand All @@ -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"
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions shiptest.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1315,20 +1315,20 @@
#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"
#include "code\game\objects\items\melee\spear.dm"
#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"
Expand Down

0 comments on commit 57de0bf

Please sign in to comment.