mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 21:48:21 +01:00
Converts two-handedness/wielding to a component (#21619)
* initial checkin * Add everything but maps * update paths * Patches some minor bugs across twohanded things * remove a stowaway * Update code/__DEFINES/dcs/signals.dm Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> * Contra review * Fix kc * hopefully fix file perms * Fix file perms * revert line-endings * uh? * Trying once again to fix file formats * henri review 1 * henri review 2 * update from master * Removes override that breaks modsuits * re-add reference --------- Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/obj/structure/closet/fireaxecabinet
|
||||
name = "fire axe cabinet"
|
||||
desc = "There is small label that reads \"For Emergency use only\" along with details for safe use of the axe. As if."
|
||||
var/obj/item/twohanded/fireaxe/fireaxe
|
||||
var/obj/item/fireaxe/fireaxe
|
||||
icon_state = "fireaxe_full_0hits"
|
||||
icon_closed = "fireaxe_full_0hits"
|
||||
icon_opened = "fireaxe_full_open"
|
||||
@@ -18,7 +18,7 @@
|
||||
var/has_axe = null // Use a string over a boolean value to make the sprite names more readable
|
||||
|
||||
/obj/structure/closet/fireaxecabinet/populate_contents()
|
||||
fireaxe = new/obj/item/twohanded/fireaxe(src)
|
||||
fireaxe = new/obj/item/fireaxe(src)
|
||||
has_axe = "full"
|
||||
update_icon(UPDATE_ICON_STATE) // So its initial icon doesn't show it without the fireaxe
|
||||
|
||||
@@ -60,10 +60,10 @@
|
||||
localopened = TRUE
|
||||
update_icon(UPDATE_ICON_STATE)
|
||||
return
|
||||
if(istype(O, /obj/item/twohanded/fireaxe) && localopened)
|
||||
if(istype(O, /obj/item/fireaxe) && localopened)
|
||||
if(!fireaxe)
|
||||
var/obj/item/twohanded/fireaxe/F = O
|
||||
if(F.wielded)
|
||||
var/obj/item/fireaxe/F = O
|
||||
if(HAS_TRAIT(F, TRAIT_WIELDED))
|
||||
to_chat(user, "<span class='warning'>Unwield \the [F] first.</span>")
|
||||
return
|
||||
if(!user.unEquip(F, FALSE))
|
||||
|
||||
@@ -83,8 +83,8 @@
|
||||
new /obj/item/caution(src)
|
||||
new /obj/item/caution(src)
|
||||
new /obj/item/caution(src)
|
||||
new /obj/item/twohanded/push_broom(src)
|
||||
new /obj/item/twohanded/push_broom(src)
|
||||
new /obj/item/push_broom(src)
|
||||
new /obj/item/push_broom(src)
|
||||
new /obj/item/storage/bag/trash(src)
|
||||
new /obj/item/storage/bag/trash(src)
|
||||
new /obj/item/lightreplacer(src)
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
to_chat(user, "<span class='warning'>You must wait until the door has stopped moving.</span>")
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/gun/energy/plasmacutter) || istype(W, /obj/item/pickaxe/drill/diamonddrill) || istype(W, /obj/item/pickaxe/drill/jackhammer) || istype(W, /obj/item/melee/energy/blade) || istype(W, /obj/item/twohanded/required/pyro_claws))
|
||||
if(istype(W, /obj/item/gun/energy/plasmacutter) || istype(W, /obj/item/pickaxe/drill/diamonddrill) || istype(W, /obj/item/pickaxe/drill/jackhammer) || istype(W, /obj/item/melee/energy/blade) || istype(W, /obj/item/pyro_claws))
|
||||
dismantle(user, TRUE)
|
||||
|
||||
/obj/structure/falsewall/attack_animal(mob/living/simple_animal/M)
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
icon_state = "fullgrass_[rand(1, 3)]"
|
||||
|
||||
|
||||
/obj/item/twohanded/required/kirbyplants
|
||||
/obj/item/kirbyplants
|
||||
name = "potted plant"
|
||||
icon = 'icons/obj/flora/plants.dmi'
|
||||
icon_state = "plant-1"
|
||||
@@ -262,59 +262,59 @@
|
||||
layer = ABOVE_MOB_LAYER
|
||||
w_class = WEIGHT_CLASS_HUGE
|
||||
force = 10
|
||||
force_wielded = 10
|
||||
throwforce = 13
|
||||
throw_speed = 2
|
||||
throw_range = 4
|
||||
/// Method to track plant overlay on mob for later removal
|
||||
var/mutable_appearance/mob_overlay
|
||||
|
||||
/obj/item/twohanded/required/kirbyplants/Initialize(mapload)
|
||||
/obj/item/kirbyplants/Initialize(mapload)
|
||||
. = ..()
|
||||
icon_state = "plant-[rand(1,35)]"
|
||||
if(prob(1))
|
||||
icon_state = "plant-36"
|
||||
AddComponent(/datum/component/two_handed, require_twohands = TRUE)
|
||||
|
||||
/obj/item/twohanded/required/kirbyplants/Destroy()
|
||||
/obj/item/kirbyplants/Destroy()
|
||||
if(iscarbon(loc))
|
||||
unhide_user(loc)
|
||||
|
||||
QDEL_NULL(mob_overlay)
|
||||
return ..()
|
||||
|
||||
/obj/item/twohanded/required/kirbyplants/equipped(mob/living/carbon/user)
|
||||
/obj/item/kirbyplants/equipped(mob/living/carbon/user)
|
||||
. = ..()
|
||||
if(wielded)
|
||||
if(HAS_TRAIT(src, TRAIT_WIELDED))
|
||||
hide_user(user)
|
||||
return
|
||||
unhide_user(user)
|
||||
|
||||
/// User has decided to hold a plant, apply stealth.
|
||||
/obj/item/twohanded/required/kirbyplants/proc/hide_user(mob/living/carbon/user)
|
||||
/obj/item/kirbyplants/proc/hide_user(mob/living/carbon/user)
|
||||
RegisterSignal(user, COMSIG_CARBON_REGENERATE_ICONS, PROC_REF(reapply_hide))
|
||||
mob_overlay = mutable_appearance(icon, icon_state, user.layer, user.plane, 255, appearance_flags = RESET_COLOR | RESET_TRANSFORM | RESET_ALPHA | KEEP_APART)
|
||||
user.add_overlay(mob_overlay)
|
||||
user.alpha = 0
|
||||
|
||||
/// User has either dropped the plant, or plant is being destroyed, restore user to normal.
|
||||
/obj/item/twohanded/required/kirbyplants/proc/unhide_user(mob/living/carbon/user)
|
||||
/obj/item/kirbyplants/proc/unhide_user(mob/living/carbon/user)
|
||||
UnregisterSignal(user, COMSIG_CARBON_REGENERATE_ICONS)
|
||||
user.cut_overlay(mob_overlay)
|
||||
user.alpha = initial(user.alpha)
|
||||
QDEL_NULL(mob_overlay)
|
||||
|
||||
/// Icon operation has occured, time to make sure we're showing a plant again if we need to be.
|
||||
/obj/item/twohanded/required/kirbyplants/proc/reapply_hide(mob/living/carbon/user)
|
||||
/obj/item/kirbyplants/proc/reapply_hide(mob/living/carbon/user)
|
||||
SIGNAL_HANDLER
|
||||
// Reset the state of the user
|
||||
unhide_user(user)
|
||||
hide_user(user)
|
||||
|
||||
/obj/item/twohanded/required/kirbyplants/dropped(mob/living/carbon/user)
|
||||
/obj/item/kirbyplants/dropped(mob/living/carbon/user)
|
||||
..()
|
||||
unhide_user(user)
|
||||
|
||||
/obj/item/twohanded/required/kirbyplants/dead
|
||||
/obj/item/kirbyplants/dead
|
||||
name = "\improper RD's potted plant"
|
||||
desc = "A gift from the botanical staff, presented after the RD's reassignment. There's a tag on it that says \"Y'all come back now, y'hear?\"\nIt doesn't look very healthy..."
|
||||
icon_state = "plant-dead"
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
refundMetal(metalUsed)
|
||||
qdel(src)
|
||||
|
||||
else if(istype(W, /obj/item/twohanded/required/pyro_claws))
|
||||
else if(istype(W, /obj/item/pyro_claws))
|
||||
playsound(loc, W.usesound, 100, 1)
|
||||
to_chat(user, "<span class='notice'>You melt the girder!</span>")
|
||||
refundMetal(metalUsed)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
var/amount_per_transfer_from_this = 5 //shit I dunno, adding this so syringes stop runtime erroring. --NeoFite
|
||||
var/obj/item/storage/bag/trash/mybag = null
|
||||
var/obj/item/mop/mymop = null
|
||||
var/obj/item/twohanded/push_broom/mybroom = null
|
||||
var/obj/item/push_broom/mybroom = null
|
||||
var/obj/item/reagent_containers/spray/cleaner/myspray = null
|
||||
var/obj/item/lightreplacer/myreplacer = null
|
||||
var/signs = 0
|
||||
@@ -59,9 +59,9 @@
|
||||
m.janicart_insert(user, src)
|
||||
else
|
||||
to_chat(user, fail_msg)
|
||||
else if(istype(I, /obj/item/twohanded/push_broom))
|
||||
else if(istype(I, /obj/item/push_broom))
|
||||
if(!mybroom)
|
||||
var/obj/item/twohanded/push_broom/B = I
|
||||
var/obj/item/push_broom/B = I
|
||||
B.janicart_insert(user, src)
|
||||
else
|
||||
to_chat(user, fail_msg)
|
||||
|
||||
Reference in New Issue
Block a user