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 MysticalFaceLesS committed Oct 6, 2024
1 parent c4cfda6 commit 4a8f07b
Show file tree
Hide file tree
Showing 29 changed files with 296 additions and 345 deletions.
2 changes: 1 addition & 1 deletion _maps/RandomRuins/JungleRuins/jungle_paradise.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5181,7 +5181,7 @@
pixel_x = 7;
pixel_y = 6
},
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
pixel_y = 28
},
/turf/open/floor/mineral/titanium,
Expand Down
6 changes: 3 additions & 3 deletions _maps/RandomRuins/SpaceRuins/singularity_lab.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -8625,13 +8625,13 @@
/turf/open/floor/plasteel/grimy,
/area/ruin/space/has_grav/singularitylab/lab)
"HU" = (
/obj/structure/fireaxecabinet{
pixel_y = 32
},
/obj/structure/sign/warning/incident{
pixel_x = -32
},
/obj/effect/decal/cleanable/cobweb,
/obj/structure/cabinet/fireaxe{
pixel_y = 28
},
/turf/open/floor/plasteel/dark,
/area/ruin/space/has_grav/singularitylab/engineering)
"HW" = (
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/independent/independent_lagoon.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2347,7 +2347,7 @@
},
/obj/item/clothing/suit/hooded/wintercoat/engineering/atmos,
/obj/item/clothing/gloves/color/black,
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
dir = 8;
pixel_x = 28
},
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/inteq/inteq_talos.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2090,7 +2090,7 @@
dir = 1
},
/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden/layer4,
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
dir = 1;
pixel_y = -32
},
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/nanotrasen/nanotrasen_heron.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -13621,7 +13621,7 @@
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{
dir = 6
},
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
pixel_y = 27
},
/obj/structure/closet/secure_closet/engineering_electrical,
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/nanotrasen/nanotrasen_osprey.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5632,7 +5632,7 @@
/obj/machinery/atmospherics/pipe/manifold/supply/hidden/layer2{
dir = 1
},
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
pixel_y = 32
},
/obj/structure/cable{
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/nanotrasen/nanotrasen_skipper.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@
/turf/open/floor/plasteel/white,
/area/ship/medical)
"dZ" = (
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
pixel_y = -29
},
/obj/structure/catwalk/over/plated_catwalk/dark,
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/pirate/pirate_libertatia.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4{
dir = 4
},
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
pixel_y = 32
},
/turf/open/floor/pod/light,
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/syndicate/syndicate_gorlex_komodo.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@
dir = 4
},
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden/layer4,
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
dir = 8;
pixel_x = 27
},
Expand Down
2 changes: 1 addition & 1 deletion _maps/shuttles/syndicate/syndicate_twinkleshine.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3500,7 +3500,7 @@
pixel_y = 4
},
/obj/item/storage/toolbox/electrical,
/obj/structure/fireaxecabinet{
/obj/structure/cabinet/fireaxe{
pixel_y = -32;
dir = 1
},
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/dcs/signals/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@
#define COMPONENT_TWOHANDED_BLOCK_WIELD 1
#define COMSIG_TWOHANDED_UNWIELD "twohanded_unwield" //from base of datum/component/two_handed/proc/unwield(mob/living/carbon/user): (/mob/user)


// /datum/action signals
#define COMSIG_ACTION_TRIGGER "action_trigger" //from base of datum/action/proc/Trigger(): (datum/action)
#define COMPONENT_ACTION_BLOCK_TRIGGER 1
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_NO_STORAGE_INSERT "no_storage_insert" //cannot be inserted in a storage.
#define TRAIT_T_RAY_VISIBLE "t-ray-visible" // Visible on t-ray scanners if the atom/var/level == 1
#define TRAIT_NO_TELEPORT "no-teleport" //you just can't
#define TRAIT_WIELDED "wielded" //The item is currently being wielded

//quirk traits
#define TRAIT_ALCOHOL_TOLERANCE "alcohol_tolerance"
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ GLOBAL_LIST_INIT(WALLITEMS, typecacheof(list(
/obj/machinery/newscaster, /obj/machinery/firealarm, /obj/structure/noticeboard, /obj/machinery/button,
/obj/machinery/computer/security/telescreen, /obj/machinery/embedded_controller/radio/simple_vent_controller,
/obj/item/storage/secure/safe, /obj/machinery/door_timer, /obj/machinery/flasher, /obj/machinery/keycard_auth,
/obj/structure/mirror, /obj/structure/fireaxecabinet, /obj/machinery/computer/security/telescreen/entertainment,
/obj/structure/mirror, /obj/structure/cabinet, /obj/machinery/computer/security/telescreen/entertainment,
/obj/structure/sign/picture_frame, /obj/machinery/bounty_board
)))

Expand Down
5 changes: 4 additions & 1 deletion code/datums/components/twohanded.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* When applied to an item it will make it two handed
*
*/

/datum/component/two_handed
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS // Only one of the component can exist on an item
var/wielded = FALSE /// Are we holding the two handed item properly
Expand Down Expand Up @@ -145,6 +146,7 @@
if(SEND_SIGNAL(parent, COMSIG_TWOHANDED_WIELD, user) & COMPONENT_TWOHANDED_BLOCK_WIELD)
return // blocked wield from item
wielded = TRUE
ADD_TRAIT(parent, TRAIT_WIELDED, REF(src))
RegisterSignal(user, COMSIG_MOB_SWAP_HANDS, PROC_REF(on_swap_hands))

// update item stats and name
Expand Down Expand Up @@ -188,6 +190,7 @@

// wield update status
wielded = FALSE
REMOVE_TRAIT(parent, TRAIT_WIELDED, REF(src))
UnregisterSignal(user, COMSIG_MOB_SWAP_HANDS)
SEND_SIGNAL(parent, COMSIG_TWOHANDED_UNWIELD, user)

Expand Down Expand Up @@ -303,7 +306,7 @@
sharpened_increase = min(amount, (max_amount - wielded_val))
return COMPONENT_BLOCK_SHARPEN_APPLIED

/**
/*
* The offhand dummy item for two handed items
*
*/
Expand Down
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
13 changes: 0 additions & 13 deletions code/game/objects/items/defib.dm
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,6 @@
AddElement(/datum/element/update_icon_updates_onmob)
AddComponent(/datum/component/two_handed, force_unwielded=8, force_wielded=12)

/// triggered on wield of two handed item
/obj/item/shockpaddles/proc/on_wield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = TRUE

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

wielded = FALSE

/obj/item/shockpaddles/Destroy()
defib = null
Expand Down Expand Up @@ -369,8 +358,6 @@
/obj/item/shockpaddles/Initialize()
. = ..()
ADD_TRAIT(src, TRAIT_NO_STORAGE_INSERT, GENERIC_ITEM_TRAIT) //stops shockpaddles from being inserted in BoH
RegisterSignal(src, COMSIG_TWOHANDED_WIELD, PROC_REF(on_wield))
RegisterSignal(src, COMSIG_TWOHANDED_UNWIELD, PROC_REF(on_unwield))
if(!req_defib)
return //If it doesn't need a defib, just say it exists
if (!loc || !istype(loc, /obj/item/defibrillator)) //To avoid weird issues from admin spawns
Expand Down
20 changes: 1 addition & 19 deletions code/game/objects/items/melee/chainsaw.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,12 @@
tool_behaviour = TOOL_SAW
toolspeed = 0.5
var/on = FALSE
var/wielded = FALSE // track wielded status on item

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

/obj/item/chainsaw/ComponentInitialize()
. = ..()
AddComponent(/datum/component/butchering, 30, 100, 0, 'sound/weapons/chainsawhit.ogg', TRUE)
AddComponent(/datum/component/two_handed, require_twohands=TRUE)

/// triggered on wield of two handed item
/obj/item/chainsaw/proc/on_wield(obj/item/source, mob/user)
SIGNAL_HANDLER

wielded = TRUE

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

wielded = FALSE

/obj/item/chainsaw/attack_self(mob/user)
on = !on
to_chat(user, "As you pull the starting cord dangling from [src], [on ? "it begins to whirr." : "the chain stops moving."]")
Expand All @@ -67,7 +49,7 @@
A.UpdateButtonIcon()

/obj/item/chainsaw/get_dismemberment_chance()
if(wielded)
if(HAS_TRAIT(src, TRAIT_WIELDED))
. = ..()

/obj/item/chainsaw/doomslayer
Expand Down
22 changes: 9 additions & 13 deletions code/game/objects/items/melee/dualsaber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
var/two_hand_force = 34
var/hacked = FALSE
var/list/possible_colors = list("red", "blue", "green", "purple", "yellow")
var/wielded = FALSE // track wielded status on item

/obj/item/dualsaber/ComponentInitialize()
. = ..()
Expand All @@ -43,7 +42,6 @@
if(user.dna.check_mutation(HULK))
to_chat(user, "<span class='warning'>You lack the grace to wield this!</span>")
return COMPONENT_TWOHANDED_BLOCK_WIELD
wielded = TRUE
sharpness = IS_SHARP
w_class = w_class_on
hitsound = 'sound/weapons/blade1.ogg'
Expand All @@ -56,16 +54,14 @@
/obj/item/dualsaber/proc/on_unwield(obj/item/source, mob/living/carbon/user)
SIGNAL_HANDLER

wielded = FALSE
sharpness = initial(sharpness)
w_class = initial(w_class)
hitsound = "swing_hit"
STOP_PROCESSING(SSobj, src)
set_light_on(FALSE)


/obj/item/dualsaber/update_icon_state()
icon_state = wielded ? "dualsaber[saber_color]" : "dualsaber"
icon_state = HAS_TRAIT(src, TRAIT_WIELDED) ? "dualsaber[saber_color]" : "dualsaber"
return ..()

/obj/item/dualsaber/Initialize()
Expand Down Expand Up @@ -94,46 +90,46 @@
if(user.has_dna())
if(user.dna.check_mutation(HULK))
to_chat(user, "<span class='warning'>You grip the blade too hard and accidentally drop it!</span>")
if(wielded)
if(HAS_TRAIT(src, TRAIT_WIELDED))
user.dropItemToGround(src, force=TRUE)
return
..()
if(wielded && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(40))
if(HAS_TRAIT(src, TRAIT_WIELDED) && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(40))
impale(user)
return
if(wielded && prob(50))
if(HAS_TRAIT(src, TRAIT_WIELDED) && prob(50))
INVOKE_ASYNC(src, PROC_REF(jedi_spin), user)

/obj/item/dualsaber/proc/jedi_spin(mob/living/user)
dance_rotate(user, CALLBACK(user, TYPE_PROC_REF(/mob, dance_flip)))

/obj/item/dualsaber/proc/impale(mob/living/user)
to_chat(user, "<span class='warning'>You twirl around a bit before losing your balance and impaling yourself on [src].</span>")
if(wielded)
if(HAS_TRAIT(src, TRAIT_WIELDED))
user.take_bodypart_damage(20,25,check_armor = TRUE)
else
user.adjustStaminaLoss(25)

/obj/item/dualsaber/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))
return ..()
return 0

/obj/item/dualsaber/process()
if(wielded)
if(HAS_TRAIT(src, TRAIT_WIELDED))
if(hacked)
set_light_color(pick(COLOR_SOFT_RED, LIGHT_COLOR_GREEN, LIGHT_COLOR_LIGHT_CYAN, LIGHT_COLOR_LAVENDER))
open_flame()
else
STOP_PROCESSING(SSobj, src)

/obj/item/dualsaber/IsReflect()
if(wielded)
if(HAS_TRAIT(src, TRAIT_WIELDED))
return 1

/obj/item/dualsaber/ignition_effect(atom/A, mob/user)
// same as /obj/item/melee/transforming/energy, mostly
if(!wielded)
if(!HAS_TRAIT(src, TRAIT_WIELDED))
return ""
var/in_mouth = ""
if(iscarbon(user))
Expand Down
Loading

0 comments on commit 4a8f07b

Please sign in to comment.