From b6f650366bc24e976b2c806a2c02c77598498cd5 Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Mon, 15 Apr 2024 10:39:48 +0200 Subject: [PATCH] Door rigging tool (#18899) Added a door rigging tool, it allows you to mine a door, so that when it opens, it explodes. Requires the door to be welded shut first. Added a box and antag uplink item for the above. --------- Signed-off-by: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Co-authored-by: Geeves --- .../stealthy and inconspicuous weapons.dm | 7 +++ code/game/objects/items/weapons/landmines.dm | 63 +++++++++++++++++++ .../objects/items/weapons/storage/boxes.dm | 5 ++ html/changelogs/fluffyghost-doorrigging.yml | 42 +++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 html/changelogs/fluffyghost-doorrigging.yml diff --git a/code/datums/uplink/stealthy and inconspicuous weapons.dm b/code/datums/uplink/stealthy and inconspicuous weapons.dm index 8304c72ccf7..784ba8ec07a 100644 --- a/code/datums/uplink/stealthy and inconspicuous weapons.dm +++ b/code/datums/uplink/stealthy and inconspicuous weapons.dm @@ -62,6 +62,13 @@ telecrystal_cost = 5 path = /obj/item/storage/box/landmines/standstill +/datum/uplink_item/item/stealthy_weapons/door_rigging_landmines + name = "Door Rigging Landmines" + desc = "A box with 5 door rigging landmines, which will explode when the door they are attached to opens. \ + You need to weld the door closed to use this, so do not forget to have a welder and probably some welding goggles with you." + telecrystal_cost = 5 + path = /obj/item/storage/box/landmines/door_rigging + /datum/uplink_item/item/stealthy_weapons/claymore_mines name = "Claymore Mines" desc = "A box with 5 claymore miners, relative detonators (signalers), and a spare one for you to trigger them all." diff --git a/code/game/objects/items/weapons/landmines.dm b/code/game/objects/items/weapons/landmines.dm index 7324d2c0126..8c6ddfe41f5 100644 --- a/code/game/objects/items/weapons/landmines.dm +++ b/code/game/objects/items/weapons/landmines.dm @@ -196,6 +196,69 @@ fragem(src,num_fragments,num_fragments,explosion_size,explosion_size+1,fragment_damage,damage_step,TRUE) qdel(src) +/** + * # Door Rigging Landmine + * + * A landmine that will explode when the door it is attached to opens + */ +/obj/item/landmine/frag/door_rigging + name = "door rigging landmine" + fragment_damage = 20 + + ///The airlock that we are observing for when it opens, to explode + var/obj/machinery/door/airlock/door_rigged + +//Prevent this mine to be used like a normal one +/obj/item/landmine/frag/door_rigging/attack_self(mob/user) + to_chat(user, SPAN_ALERT("This landmine is not usable in this way, you need to apply it to a door.")) + return + +/obj/item/landmine/frag/door_rigging/resolve_attackby(atom/A, mob/user, click_parameters) + . = ..() + + if(istype(A, /obj/machinery/door/airlock)) + + door_rigged = A + var/turf/turf_under_door = get_turf(door_rigged) + + //Prevent people from exploding themselves by targeting a door that will open once clicked + if(!door_rigged.welded || !door_rigged.density || !istype(turf_under_door) || locate(/obj/item/landmine) in turf_under_door) + to_chat(user, SPAN_WARNING("The door is not welded, is open, is already rigged or does not have a turf below it.")) + door_rigged = null //Clean up the var + return + + //Take a little to do this + if(!do_after(user, 10 SECONDS, door_rigged)) + door_rigged = null + return + + RegisterSignal(door_rigged, COMSIG_QDELETING, PROC_REF(handle_door_qdel)) + + deploy(user) + src.forceMove(turf_under_door) + + activate(user) + + START_PROCESSING(SSfast_process, src) + +/obj/item/landmine/frag/door_rigging/process(seconds_per_tick) + if(QDELETED(door_rigged)) + STOP_PROCESSING(SSfast_process, src) + qdel(src) + + if(!door_rigged.density) + STOP_PROCESSING(SSfast_process, src) + trigger(null) + +///Clear the reference and delete the mine if the door gets deleted +/obj/item/landmine/frag/door_rigging/proc/handle_door_qdel() + SIGNAL_HANDLER + + door_rigged = null + STOP_PROCESSING(SSfast_process, src) + qdel(src) + + /** * # Radiation Landmine * diff --git a/code/game/objects/items/weapons/storage/boxes.dm b/code/game/objects/items/weapons/storage/boxes.dm index b0e8984f050..a0845c9c2c5 100644 --- a/code/game/objects/items/weapons/storage/boxes.dm +++ b/code/game/objects/items/weapons/storage/boxes.dm @@ -1276,6 +1276,11 @@ desc = "A box containing 5 standstill landmines." starts_with = list(/obj/item/landmine/standstill = 5) +/obj/item/storage/box/landmines/door_rigging + name = "box of door rigging landmines" + desc = "A box containing 5 door rigging landmines." + starts_with = list(/obj/item/landmine/frag/door_rigging = 5) + /obj/item/storage/box/landmines/claymore name = "box of claymore landmines" desc = "A box containing 5 claymore landmines, relative detonators, and a spare one to trigger them all." diff --git a/html/changelogs/fluffyghost-doorrigging.yml b/html/changelogs/fluffyghost-doorrigging.yml new file mode 100644 index 00000000000..93996628497 --- /dev/null +++ b/html/changelogs/fluffyghost-doorrigging.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added a door rigging tool, it allows you to mine a door, so that when it opens, it explodes. Requires the door to be welded shut first." + - rscadd: "Added a box and antag uplink item for the above."