Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang Yourself ♡ #1942

Closed
wants to merge 16 commits into from
7 changes: 7 additions & 0 deletions code/datums/components/crafting/recipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,13 @@
/obj/item/stack/rods = 1)
category = CAT_MISC

/datum/crafting_recipe/noose
name = "Noose"
result = /obj/structure/chair/noose
reqs = list(/obj/item/stack/cable_coil = 20)
time = 20 //i mean cmon you gotta attach it to the damn ceiling (fuck you cox its REAAL)
Litberries marked this conversation as resolved.
Show resolved Hide resolved
category = CAT_MISC

/datum/crafting_recipe/papersack
name = "Paper Sack"
result = /obj/item/storage/box/papersack
Expand Down
150 changes: 150 additions & 0 deletions code/game/objects/structures/noose.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/obj/item/stack/cable_coil/building_checks(datum/stack_recipe/R, multiplier)
if(R.result_type == /obj/structure/chair/noose)
if(!(locate(/obj/structure/chair) in get_turf(usr)))
to_chat(usr, span_warning("You have to be standing on top of a chair to make a noose!"))
return FALSE
return ..()

/obj/structure/chair/noose //It's a "chair".
name = "noose"
desc = "Hang in there!"
icon_state = "noose"
icon = 'icons/obj/noose.dmi'
layer = FLY_LAYER
flags_1 = NODECONSTRUCT_1
var/mutable_appearance/overlay

/obj/structure/chair/noose/attackby(obj/item/W, mob/user, params)
if(W.tool_behaviour != TOOL_WIRECUTTER)
return ..()
user.visible_message("[user] cuts the noose.", span_notice("You cut the noose."))
if(has_buckled_mobs())
for(var/m in buckled_mobs)
var/mob/living/buckled_mob = m
if(buckled_mob.has_gravity())
buckled_mob.visible_message(span_warning("[buckled_mob] falls over and hits the ground!"))
to_chat(buckled_mob, span_userdanger("You fall over and hit the ground!"))
buckled_mob.adjustBruteLoss(10)
var/obj/item/stack/cable_coil/C = new(get_turf(src))
C.amount = 25
qdel(src)

/obj/structure/chair/noose/Initialize(mapload)
. = ..()
pixel_y += 16 //Noose looks like it's "hanging" in the air
overlay = image(icon, "noose_overlay")
overlay.layer = FLY_LAYER
add_overlay(overlay)

/obj/structure/chair/noose/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()

/obj/structure/chair/noose/post_buckle_mob(mob/living/M)
if(has_buckled_mobs())
src.layer = MOB_LAYER
START_PROCESSING(SSobj, src)
M.dir = SOUTH
animate(M, pixel_y = initial(pixel_y) + 8, time = 8, easing = LINEAR_EASING)
else
layer = initial(layer)
STOP_PROCESSING(SSobj, src)
M.pixel_x = M.base_pixel_x
pixel_x = base_pixel_x
M.pixel_y = M.body_position_pixel_y_offset

/obj/structure/chair/noose/user_unbuckle_mob(mob/living/M,mob/living/user)
if(has_buckled_mobs())
if(M != user)
user.visible_message(span_notice("[user] begins to untie the noose over [M]'s neck..."))
to_chat(user, span_notice("You begin to untie the noose over [M]'s neck..."))
if(!do_after(user, 10 SECONDS, M))
return
user.visible_message(span_notice("[user] unties the noose over [M]'s neck!"))
to_chat(user, span_notice("You untie the noose over [M]'s neck!"))
M.Knockdown(60)
else
M.visible_message(span_warning("[M] struggles to untie the noose over their neck!"))
to_chat(M, span_notice("You struggle to untie the noose over your neck... (Stay still for 20 seconds.)"))
if(!do_after(M, 200, target = src)) // yeah if you dont try to untie yourself in like 6 seconds you're cooked
if(M && M.buckled)
to_chat(M, span_warning("You fail to untie yourself!"))
return
if(!M.buckled)
return
M.visible_message(span_warning("[M] unties the noose over their neck!"))
to_chat(M,span_notice("You untie the noose over your neck!"))
M.Knockdown(60)
unbuckle_all_mobs(force=1)
M.pixel_z = initial(M.pixel_z)
pixel_z = initial(pixel_z)
M.pixel_x = M.base_pixel_x
pixel_x = base_pixel_x
add_fingerprint(user)

/obj/structure/chair/noose/user_buckle_mob(mob/living/carbon/human/M, mob/user, check_loc = TRUE)
//if(!in_range(user, src) || user.stat || user.restrained() || !iscarbon(M))
Litberries marked this conversation as resolved.
Show resolved Hide resolved
//return FALSE

if (!M.get_bodypart("head"))
to_chat(user, span_warning("[M] has no head!"))
return FALSE

if(M.loc != src.loc)
return FALSE //Can only noose someone if they're on the same tile as noose

add_fingerprint(user)
log_combat(user, M, "Attempted to Hang", src)
M.visible_message(span_danger("[user] attempts to tie \the [src] over [M]'s neck!"))
if(user != M)
to_chat(user, span_notice("It will take 20 seconds and you have to stand still."))
if(do_after(user, user == M ? 0:20 SECONDS, M))
if(buckle_mob(M))
user.visible_message(span_warning("[user] ties \the [src] over [M]'s neck!"))
if(user == M)
to_chat(M, span_userdanger("You tie \the [src] over your neck!"))
else
to_chat(M, span_userdanger("[user] ties \the [src] over your neck!"))
playsound(user.loc, 'sound/effects/noosed.ogg', 50, 1, -1)
log_combat(user, M, "hanged", src)
return TRUE
user.visible_message(span_warning("[user] fails to tie \the [src] over [M]'s neck!"))
to_chat(user, span_warning("You fail to tie \the [src] over [M]'s neck!"))
return FALSE


/obj/structure/chair/noose/process()
if(!has_buckled_mobs())
STOP_PROCESSING(SSobj, src)
return
for(var/m in buckled_mobs)
var/mob/living/buckled_mob = m
if(pixel_x >= 0)
animate(src, pixel_x = -3, time = 45, easing = ELASTIC_EASING)
animate(m, pixel_x = -3, time = 45, easing = ELASTIC_EASING)
else
animate(src, pixel_x = 3, time = 45, easing = ELASTIC_EASING)
animate(m, pixel_x = 3, time = 45, easing = ELASTIC_EASING)
if(buckled_mob.has_gravity())
if(buckled_mob.get_bodypart("head"))
if(buckled_mob.stat != DEAD)
if(!HAS_TRAIT(buckled_mob, TRAIT_NOBREATH))
buckled_mob.adjustOxyLoss(5)
if(prob(40))
buckled_mob.emote("gasp")
if(prob(20))
var/flavor_text = list(span_suicide("[buckled_mob]'s legs flail for anything to stand on."),\
span_suicide("[buckled_mob]'s hands are desperately clutching the noose."),\
span_suicide("[buckled_mob]'s limbs sway back and forth with diminishing strength.")
)

buckled_mob.visible_message(pick(flavor_text))
playsound(buckled_mob.loc, 'sound/effects/noose_idle.ogg', 30, 1, -3)
else
buckled_mob.visible_message(span_danger("[buckled_mob] drops from the noose!"))
buckled_mob.Knockdown(60)
buckled_mob.pixel_z = initial(buckled_mob.pixel_z)
pixel_z = initial(pixel_z)
buckled_mob.pixel_x = initial(buckled_mob.pixel_x)
pixel_x = initial(pixel_x)
unbuckle_all_mobs(force=1)
Binary file added icons/obj/noose.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions lobotomy-corp13.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,7 @@
#include "code\game\objects\structures\mirror.dm"
#include "code\game\objects\structures\mop_bucket.dm"
#include "code\game\objects\structures\morgue.dm"
#include "code\game\objects\structures\noose.dm"
#include "code\game\objects\structures\noticeboard.dm"
#include "code\game\objects\structures\ordealmonitor.dm"
#include "code\game\objects\structures\petrified_statue.dm"
Expand Down
Binary file added sound/effects/noose_idle.ogg
Binary file not shown.
Binary file added sound/effects/noosed.ogg
Binary file not shown.
Loading