mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-01 05:02:33 +00:00
* refactor: Attack chain, initial setup. * migrate curtain to make dreamchecker happy * update thurible * don't call attacked_by separately for legacy attack chain * remove duplicate proc * condense similar code, put allowances for legacy code in new procs * update docs, include diagram source * add comment on how to update diagram * fix admonition * mindflayer updates * remove commented out code * clarify all steps * after_attack should be overridable * whoops * retrofit recent changes * duh, can't restrict this yet because of tool_acts * i hate ore bags with the fire of a thousand suns * return correct value for object attack logic * Various cleanups. We don't want to attempt to pull stuff out of `/obj/item/attackby`, because those pieces are part of the related objects' migrations, not `/obj/item` itself. Attempting to do this causes knockon effects where things expected to call e.g. `/obj/item/storage/attackby` in the call chain were not ferried over to the new item interaction code, because the related objects hadn't actually been migrated over yet. I've used refactoring /obj/vehicle as the example for migrating `attackby` methods instead. * simplify some argument names * fuck it * make it do the thing * Rename CI module call * Prove that CI works * improve test output * aaand fix it again * fix curtain tool interactions * fix compile error * fix compile error * Better docs, introduce migration plan tool.
179 lines
5.8 KiB
Plaintext
179 lines
5.8 KiB
Plaintext
/*
|
|
* Contains:
|
|
* Traitor fiber wire
|
|
* Improvised garrotes
|
|
*/
|
|
|
|
/// 12TC traitor item
|
|
/obj/item/garrote
|
|
name = "fiber wire"
|
|
desc = "A length of razor-thin wire with an elegant wooden handle on either end.<br>You suspect you'd have to be behind the target to use this weapon effectively."
|
|
icon = 'icons/obj/weapons/melee.dmi'
|
|
icon_state = "garrot_wrap"
|
|
w_class = WEIGHT_CLASS_TINY
|
|
var/mob/living/carbon/human/strangling
|
|
var/improvised = FALSE
|
|
var/garrote_time
|
|
|
|
/obj/item/garrote/Initialize(mapload)
|
|
. = ..()
|
|
AddComponent(/datum/component/two_handed)
|
|
|
|
/obj/item/garrote/Destroy()
|
|
strangling = null
|
|
return ..()
|
|
|
|
/obj/item/garrote/update_icon_state()
|
|
if(strangling) // If we're strangling someone we want our icon to stay wielded
|
|
icon_state = "garrot_[improvised ? "I_" : ""]unwrap"
|
|
else
|
|
icon_state = "garrot_[improvised ? "I_" : ""][HAS_TRAIT(src, TRAIT_WIELDED) ? "un" : ""]wrap"
|
|
|
|
/// Made via tablecrafting
|
|
/obj/item/garrote/improvised
|
|
name = "garrote"
|
|
desc = "A length of cable with a shoddily-carved wooden handle tied to either end.<br>You suspect you'd have to be behind the target to use this weapon effectively."
|
|
icon_state = "garrot_I_wrap"
|
|
improvised = TRUE
|
|
|
|
/obj/item/garrote/improvised/Initialize(mapload)
|
|
. = ..()
|
|
AddComponent(/datum/component/two_handed, wield_callback = CALLBACK(src, PROC_REF(wield)))
|
|
|
|
|
|
/obj/item/garrote/proc/wield(obj/item/source, mob/living/carbon/user)
|
|
if(!strangling)
|
|
return
|
|
user.visible_message("<span class='notice'>[user] removes [src] from [strangling]'s neck.</span>",
|
|
"<span class='warning'>You remove [src] from [strangling]'s neck.</span>")
|
|
|
|
strangling = null
|
|
update_icon(UPDATE_ICON_STATE)
|
|
STOP_PROCESSING(SSobj, src)
|
|
|
|
|
|
/obj/item/garrote/attack__legacy__attackchain(mob/living/carbon/M as mob, mob/user as mob)
|
|
if(garrote_time > world.time) // Cooldown
|
|
return
|
|
|
|
if(!ishuman(user)) // spap_hand is a proc of /mob/living, user is simply /mob
|
|
return
|
|
|
|
var/mob/living/carbon/human/U = user
|
|
|
|
if(!HAS_TRAIT(src, TRAIT_WIELDED))
|
|
to_chat(user, "<span class = 'warning'>You must use both hands to garrote [M]!</span>")
|
|
return
|
|
|
|
if(!ishuman(M))
|
|
to_chat(user, "<span class = 'warning'>You don't think that garroting [M] would be very effective...</span>")
|
|
return
|
|
|
|
if(M == U)
|
|
U.suicide() // This will display a prompt for confirmation first.
|
|
return
|
|
|
|
if(M.dir != U.dir && !M.incapacitated())
|
|
to_chat(user, "<span class='warning'>You cannot use [src] on [M] from that angle!</span>")
|
|
return
|
|
|
|
if(improvised && ((M.head && (M.head.flags_cover & HEADCOVERSMOUTH)) || (M.wear_mask && (M.wear_mask.flags_cover & MASKCOVERSMOUTH)))) // Improvised garrotes are blocked by mouth-covering items.
|
|
to_chat(user, "<span class = 'warning'>[M]'s neck is blocked by something [M.p_theyre()] wearing!</span>")
|
|
|
|
if(strangling)
|
|
to_chat(user, "<span class = 'warning'>You cannot use [src] on two people at once!</span>")
|
|
return
|
|
|
|
attack_self__legacy__attackchain(user)
|
|
|
|
U.swap_hand() // For whatever reason the grab will not properly work if we don't have the free hand active.
|
|
var/obj/item/grab/G = M.grabbedby(U, 1)
|
|
U.swap_hand()
|
|
|
|
if(G && istype(G))
|
|
if(improvised) // Improvised garrotes start you off with a passive grab, but will lock you in place. A quick stun to drop items but not to make it unescapable
|
|
M.Stun(1 SECONDS)
|
|
M.Immobilize(2 SECONDS)
|
|
else
|
|
G.state = GRAB_NECK
|
|
G.hud.icon_state = "kill"
|
|
G.hud.name = "kill"
|
|
M.AdjustSilence(2 SECONDS)
|
|
|
|
garrote_time = world.time + 10
|
|
START_PROCESSING(SSobj, src)
|
|
strangling = M
|
|
update_icon(UPDATE_ICON_STATE)
|
|
|
|
playsound(loc, 'sound/weapons/cablecuff.ogg', 15, TRUE, -10, ignore_walls = FALSE)
|
|
|
|
M.visible_message("<span class='danger'>[U] comes from behind and begins garroting [M] with [src]!</span>", \
|
|
"<span class='userdanger'>[U] begins garroting you with [src]![improvised ? "" : " You are unable to speak!"]</span>", \
|
|
"You hear struggling and wire strain against flesh!")
|
|
|
|
return
|
|
|
|
/obj/item/garrote/process()
|
|
if(!strangling)
|
|
// Our mark got gibbed or similar
|
|
update_icon(UPDATE_ICON_STATE)
|
|
STOP_PROCESSING(SSobj, src)
|
|
return
|
|
|
|
|
|
if(!ishuman(loc))
|
|
strangling = null
|
|
update_icon(UPDATE_ICON_STATE)
|
|
STOP_PROCESSING(SSobj, src)
|
|
return
|
|
|
|
var/mob/living/carbon/human/user = loc
|
|
var/obj/item/grab/G
|
|
|
|
if(src == user.r_hand && istype(user.l_hand, /obj/item/grab))
|
|
G = user.l_hand
|
|
|
|
else if(src == user.l_hand && istype(user.r_hand, /obj/item/grab))
|
|
G = user.r_hand
|
|
|
|
else
|
|
user.visible_message("<span class='warning'>[user] loses [user.p_their()] grip on [strangling]'s neck.</span>", \
|
|
"<span class='warning'>You lose your grip on [strangling]'s neck.</span>")
|
|
|
|
strangling = null
|
|
update_icon(UPDATE_ICON_STATE)
|
|
STOP_PROCESSING(SSobj, src)
|
|
|
|
return
|
|
|
|
if(!G.affecting)
|
|
user.visible_message("<span class='warning'>[user] loses [user.p_their()] grip on [strangling]'s neck.</span>", \
|
|
"<span class='warning'>You lose your grip on [strangling]'s neck.</span>")
|
|
|
|
strangling = null
|
|
update_icon(UPDATE_ICON_STATE)
|
|
STOP_PROCESSING(SSobj, src)
|
|
|
|
return
|
|
|
|
if(G.state < GRAB_NECK) // Only possible with improvised garrotes, essentially this will stun people as if they were aggressively grabbed. Allows for resisting out if you're quick, but not running away.
|
|
strangling.Immobilize(3 SECONDS)
|
|
|
|
if(improvised)
|
|
strangling.Stuttering(6 SECONDS)
|
|
strangling.apply_damage(2, OXY, "head")
|
|
return
|
|
|
|
|
|
strangling.AbsoluteSilence(6 SECONDS) // Non-improvised effects
|
|
if(G.state == GRAB_KILL)
|
|
strangling.PreventOxyHeal(6 SECONDS)
|
|
strangling.AdjustLoseBreath(6 SECONDS)
|
|
strangling.apply_damage(4, OXY, "head")
|
|
|
|
|
|
/obj/item/garrote/suicide_act(mob/user)
|
|
user.visible_message("<span class='suicide'>[user] is wrapping [src] around [user.p_their()] neck and pulling the handles! It looks like [user.p_theyre()] trying to commit suicide!</span>")
|
|
playsound(loc, 'sound/weapons/cablecuff.ogg', 15, TRUE, -10, ignore_walls = FALSE)
|
|
return OXYLOSS
|