diff --git a/code/game/objects/structures/guillotine.dm b/code/game/objects/structures/guillotine.dm new file mode 100644 index 00000000000..db2daff0e09 --- /dev/null +++ b/code/game/objects/structures/guillotine.dm @@ -0,0 +1,229 @@ +#define GUILLOTINE_BLADE_MAX_SHARP 10 // This is maxiumum sharpness that will decapitate without failure +#define GUILLOTINE_DECAP_MIN_SHARP 7 // Minimum amount of sharpness for decapitation. Any less and it will just deal brute damage +#define GUILLOTINE_ANIMATION_LENGTH 9 // How many deciseconds the animation is +#define GUILLOTINE_BLADE_RAISED 1 +#define GUILLOTINE_BLADE_MOVING 2 +#define GUILLOTINE_BLADE_DROPPED 3 +#define GUILLOTINE_BLADE_SHARPENING 4 +#define GUILLOTINE_HEAD_OFFSET 16 // How much we need to move the player to center their head +#define GUILLOTINE_LAYER_DIFF 1.2 // How much to increase/decrease a head when it's buckled/unbuckled +#define GUILLOTINE_ACTIVATE_DELAY 30 // Delay for executing someone +#define GUILLOTINE_WRENCH_DELAY 10 +#define GUILLOTINE_ACTION_INUSE 5 +#define GUILLOTINE_ACTION_WRENCH 6 + +/obj/structure/guillotine + name = "guillotine" + desc = "A large structure used to remove the heads of traitors and treasonists." + icon = 'icons/obj/guillotine.dmi' + icon_state = "guillotine_raised" + can_buckle = TRUE + anchored = TRUE + density = FALSE + buckle_lying = FALSE + layer = ABOVE_MOB_LAYER + var/blade_status = GUILLOTINE_BLADE_RAISED + var/blade_sharpness = GUILLOTINE_BLADE_MAX_SHARP // How sharp the blade is + var/kill_count = 0 + var/current_action = 0 // What's currently happening to the guillotine + +/obj/structure/guillotine/examine(mob/user) + ..() + + var/msg = "" + + msg += "It is [anchored ? "wrenched to the floor." : "unsecured. A wrench should fix that."]
" + + if(blade_status == GUILLOTINE_BLADE_RAISED) + msg += "The blade is raised, ready to fall, and" + + if(blade_sharpness >= GUILLOTINE_DECAP_MIN_SHARP) + msg += " looks sharp enough to decapitate without any resistance." + else + msg += " doesn't look particularly sharp. Perhaps a whetstone can be used to sharpen it." + else + msg += "The blade is hidden inside the stocks." + + if(has_buckled_mobs()) + msg += "
" + msg += "Someone appears to be strapped in. You can help them out, or you can harm them by activating the guillotine." + + to_chat(user, msg) + + return msg + +/obj/structure/guillotine/attack_hand(mob/user) + add_fingerprint(user) + + // Currently being used by something + if(current_action) + return + + switch(blade_status) + if(GUILLOTINE_BLADE_MOVING) + return + if(GUILLOTINE_BLADE_DROPPED) + blade_status = GUILLOTINE_BLADE_MOVING + icon_state = "guillotine_raise" + addtimer(src, "raise_blade", GUILLOTINE_ANIMATION_LENGTH) + return + if(GUILLOTINE_BLADE_RAISED) + if(has_buckled_mobs()) + if(user.a_intent == INTENT_HARM) + user.visible_message("[user] begins to pull the lever!", + "You begin to the pull the lever.") + current_action = GUILLOTINE_ACTION_INUSE + + if(do_after(user, GUILLOTINE_ACTIVATE_DELAY, target = src) && blade_status == GUILLOTINE_BLADE_RAISED) + current_action = 0 + blade_status = GUILLOTINE_BLADE_MOVING + icon_state = "guillotine_drop" + playsound(src, 'sound/items/unsheath.ogg', 100, 1) + addtimer(src, "drop_blade", GUILLOTINE_ANIMATION_LENGTH - 2, FALSE, user) // Minus two so we play the sound and decap faster + else + current_action = 0 + else + unbuckle_mob() + else + blade_status = GUILLOTINE_BLADE_MOVING + icon_state = "guillotine_drop" + playsound(src, 'sound/items/unsheath.ogg', 100, 1) + addtimer(src, "drop_blade", GUILLOTINE_ANIMATION_LENGTH) + +/obj/structure/guillotine/proc/raise_blade() + blade_status = GUILLOTINE_BLADE_RAISED + icon_state = "guillotine_raised" + +/obj/structure/guillotine/proc/drop_blade(mob/user) + if(has_buckled_mobs() && blade_sharpness) + var/mob/living/carbon/human/H = buckled_mob + + if(!H) + return + + var/obj/item/organ/external/head/head = H.get_organ("head") + + if(QDELETED(head)) + return + + playsound(src, 'sound/weapons/bladeslice.ogg', 100, 1) + if(blade_sharpness >= GUILLOTINE_DECAP_MIN_SHARP || head.brute_dam >= 100) + head.droplimb() + add_attack_logs(user, H, "beheaded with [src]") + H.regenerate_icons() + unbuckle_mob() + kill_count += 1 + + var/blood_overlay = "bloody" + + if(kill_count == 2) + blood_overlay = "bloodier" + else if(kill_count > 2) + blood_overlay = "bloodiest" + + blood_overlay = "guillotine_" + blood_overlay + "_overlay" + overlays.Cut() + overlays += mutable_appearance(icon, blood_overlay) + + // The crowd is pleased + // The delay is to make large crowds have a longer lasting applause + var/delay_offset = 0 + for(var/mob/living/carbon/human/HM in viewers(src, 7)) + addtimer(HM, "emote", delay_offset * 0.3, FALSE, "clap") + delay_offset++ + else + H.apply_damage(15 * blade_sharpness, BRUTE, head) + add_attack_logs(user, H, "dropped the blade on non-fatally with [src]") + H.emote("scream") + + if(blade_sharpness > 1) + blade_sharpness -= 1 + + blade_status = GUILLOTINE_BLADE_DROPPED + icon_state = "guillotine" + +/obj/structure/guillotine/attackby(obj/item/W, mob/user, params) + if(istype(W, /obj/item/whetstone)) + add_fingerprint(user) + if(blade_status == GUILLOTINE_BLADE_SHARPENING) + return + + if(blade_status == GUILLOTINE_BLADE_RAISED) + if(blade_sharpness < GUILLOTINE_BLADE_MAX_SHARP) + blade_status = GUILLOTINE_BLADE_SHARPENING + if(do_after(user, 7, target = src)) + blade_status = GUILLOTINE_BLADE_RAISED + user.visible_message("[user] sharpens the large blade of the guillotine.", + "You sharpen the large blade of the guillotine.") + blade_sharpness += 1 + playsound(src, 'sound/items/Screwdriver.ogg', 100, 1) + return + else + blade_status = GUILLOTINE_BLADE_RAISED + return + else + to_chat(user, "The blade is sharp enough!") + return + else + to_chat(user, "You need to raise the blade in order to sharpen it!") + return + if(iswrench(W)) + if(current_action) + return + + current_action = GUILLOTINE_ACTION_WRENCH + + if(do_after(user, GUILLOTINE_WRENCH_DELAY, target = src)) + current_action = 0 + if(has_buckled_mobs()) + to_chat(user, "Can't unfasten, someone's strapped in!") + return + + if(current_action) + return + to_chat(user, "You [anchored ? "un" : ""]secure [src].") + anchored = !anchored + playsound(src, 'sound/items/deconstruct.ogg', 50, 1) + dir = SOUTH + return TRUE + else + current_action = 0 + else + return ..() + +/obj/structure/guillotine/buckle_mob(mob/living/M, force = 0) + if(!anchored) + to_chat(usr, "The [src] needs to be wrenched to the floor!") + return FALSE + + if(!ishuman(M)) + to_chat(usr, "It doesn't look like they can fit into this properly!") + return FALSE // Can't decapitate non-humans + + if(blade_status != GUILLOTINE_BLADE_RAISED) + to_chat(usr, "You need to raise the blade before buckling someone in!") + return FALSE + + if(..()) + M.pixel_y -= GUILLOTINE_HEAD_OFFSET // Offset their body so it looks like they're in the guillotine + M.layer += GUILLOTINE_LAYER_DIFF + +/obj/structure/guillotine/unbuckle_mob(force = 0) + if(buckled_mob) + buckled_mob.pixel_y += GUILLOTINE_HEAD_OFFSET // Move their body back + buckled_mob.layer -= GUILLOTINE_LAYER_DIFF + . = ..() + +#undef GUILLOTINE_BLADE_MAX_SHARP +#undef GUILLOTINE_DECAP_MIN_SHARP +#undef GUILLOTINE_ANIMATION_LENGTH +#undef GUILLOTINE_BLADE_RAISED +#undef GUILLOTINE_BLADE_MOVING +#undef GUILLOTINE_BLADE_DROPPED +#undef GUILLOTINE_BLADE_SHARPENING +#undef GUILLOTINE_HEAD_OFFSET +#undef GUILLOTINE_LAYER_DIFF +#undef GUILLOTINE_ACTIVATE_DELAY +#undef GUILLOTINE_WRENCH_DELAY +#undef GUILLOTINE_ACTION_INUSE +#undef GUILLOTINE_ACTION_WRENCH \ No newline at end of file diff --git a/code/modules/crafting/recipes.dm b/code/modules/crafting/recipes.dm index 84226bd1f3b..f1739750a0a 100644 --- a/code/modules/crafting/recipes.dm +++ b/code/modules/crafting/recipes.dm @@ -354,3 +354,13 @@ reqs = list(/obj/item/grown/log = 5) result = /obj/structure/bonfire category = CAT_PRIMAL + +/datum/crafting_recipe/guillotine + name = "Guillotine" + result = /obj/structure/guillotine + time = 150 // Building a functioning guillotine takes time + reqs = list(/obj/item/stack/sheet/plasteel = 3, + /obj/item/stack/sheet/wood = 20, + /obj/item/stack/cable_coil = 10) + tools = list(/obj/item/screwdriver, /obj/item/wrench, /obj/item/weldingtool) + category = CAT_MISC \ No newline at end of file diff --git a/icons/obj/guillotine.dmi b/icons/obj/guillotine.dmi new file mode 100644 index 00000000000..e985dbaa825 Binary files /dev/null and b/icons/obj/guillotine.dmi differ diff --git a/paradise.dme b/paradise.dme index 438cb2acaae..18409a9c668 100644 --- a/paradise.dme +++ b/paradise.dme @@ -965,6 +965,7 @@ #include "code\game\objects\structures\fullwindow.dm" #include "code\game\objects\structures\girders.dm" #include "code\game\objects\structures\grille.dm" +#include "code\game\objects\structures\guillotine.dm" #include "code\game\objects\structures\inflatable.dm" #include "code\game\objects\structures\janicart.dm" #include "code\game\objects\structures\kitchen_spike.dm" diff --git a/sound/items/unsheath.ogg b/sound/items/unsheath.ogg new file mode 100644 index 00000000000..388ff1fc189 Binary files /dev/null and b/sound/items/unsheath.ogg differ