Skip to content

Commit

Permalink
Cabinet Refactor (shiptest-ss13#3378)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->
Mildly refactors fireaxe cabinets to allow them to be subtyped with
different items. Also adds an is_wielded proc to most weapons that can
be wielded to prevent potential weirdness with this down the line.
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->
Cabinets are soulful
<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding. -->

:cl: Erika Fox
code: Fireaxe cabinets have been repathed, and now function as a more
general cabinet object. please report any inconsistencies with behavior
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->

---------

Signed-off-by: FalloutFalcon <[email protected]>
Co-authored-by: FalloutFalcon <[email protected]>
Co-authored-by: FalloutFalcon <[email protected]>
  • Loading branch information
3 people authored and MrCat15352 committed Dec 24, 2024
1 parent aa1ca17 commit 2c00539
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 196 deletions.
2 changes: 1 addition & 1 deletion code/game/machinery/doors/airlock.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@
if(!operating)
if(istype(I, /obj/item/melee/axe/fire)) //being fireaxe'd
var/obj/item/melee/axe/fire/axe = I
if(axe && !axe.wielded)
if(axe && !HAS_TRAIT(axe, TRAIT_WIELDED))
to_chat(user, "<span class='warning'>You need to be wielding \the [axe] to do that!</span>")
return
INVOKE_ASYNC(src, (density ? PROC_REF(open) : PROC_REF(close)), 2)
Expand Down
4 changes: 0 additions & 4 deletions code/game/objects/items/melee/fireaxe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@


wielded = TRUE

/// triggered on unwield of two handed item
/obj/item/melee/axe/proc/on_unwield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = FALSE

/obj/item/melee/axe/update_icon_state()
icon_state = "[base_icon_state]0"
return ..()
/obj/item/melee/axe/afterattack(atom/A, mob/user, proximity)
. = ..()
if(!proximity)
return
Expand Down
5 changes: 1 addition & 4 deletions code/game/objects/items/melee/spear.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,9 @@
icon_prefix = "spearbomb"
var/obj/item/grenade/explosive = null
var/war_cry = "AAAAARGH!!!"
var/wielded = FALSE // track wielded status on item

/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()
Expand Down Expand Up @@ -127,7 +124,7 @@
. = ..()
if(!proximity)
return
if(wielded)
if(HAS_TRAIT(src, TRAIT_WIELDED))
user.say("[war_cry]", forced="spear warcry")
explosive.forceMove(AM)
explosive.prime()
Expand Down
10 changes: 2 additions & 8 deletions code/game/objects/items/melee/sword.dm
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,6 @@
attack_verb = list("cut", "sliced", "diced")
slot_flags = ITEM_SLOT_BACK
hitsound = 'sound/weapons/bladeslice.ogg'
var/wielded = FALSE // track wielded status on item

/obj/item/melee/sword/vibro/Initialize()
. = ..()
RegisterSignal(src, COMSIG_TWOHANDED_WIELD, PROC_REF(on_wield))
RegisterSignal(src, COMSIG_TWOHANDED_UNWIELD, PROC_REF(on_unwield))

/obj/item/melee/sword/vibro/ComponentInitialize()
. = ..()
Expand All @@ -358,9 +352,9 @@
icon_state = "[base_icon_state]0"

/obj/item/melee/sword/vibro/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
if(wielded)
if(HAS_TRAIT(src, TRAIT_WIELDED))
final_block_chance *= 2
if(wielded || attack_type != PROJECTILE_ATTACK)
if(HAS_TRAIT(src, TRAIT_WIELDED) || attack_type != PROJECTILE_ATTACK)
if(prob(final_block_chance))
if(attack_type == PROJECTILE_ATTACK)
owner.visible_message("<span class='danger'>[owner] deflects [attack_text] with [src]!</span>")
Expand Down
179 changes: 0 additions & 179 deletions code/game/objects/structures/fireaxe.dm

This file was deleted.

0 comments on commit 2c00539

Please sign in to comment.