Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LynxSolstice committed Aug 11, 2024
1 parent 0e1745d commit 10fbfeb
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/game/machinery/vending/vendor_types/requisitions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
list("M40 MFHS Metal Foam Grenade", floor(scale * 6), /obj/item/explosive/grenade/metal_foam, VENDOR_ITEM_REGULAR),
list("Plastic Explosives", floor(scale * 3), /obj/item/explosive/plastic, VENDOR_ITEM_REGULAR),
list("Breaching Charge", floor(scale * 2), /obj/item/explosive/plastic/breaching_charge, VENDOR_ITEM_REGULAR),
list("Satchel Charge Box (x5 charges, 1x detonator)", floor(scale), /obj/item/storage/box/explosive_mines/satchel_charges, VENDOR_ITEM_REGULAR),

list("WEBBINGS", -1, null, null),
list("Black Webbing Vest", floor(scale * 2), /obj/item/clothing/accessory/storage/black_vest, VENDOR_ITEM_REGULAR),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ GLOBAL_LIST_INIT(cm_vending_gear_engi, list(
list("Plasteel x10", 7, /obj/item/stack/sheet/plasteel/small_stack, null, VENDOR_ITEM_RECOMMENDED),
list("Plastic Explosive", 3, /obj/item/explosive/plastic, null, VENDOR_ITEM_REGULAR),
list("Breaching Charge", 5, /obj/item/explosive/plastic/breaching_charge, null, VENDOR_ITEM_RECOMMENDED),
list("Satchel Charge Box (x5 charges, 1x detonator)", 15, /obj/item/storage/box/explosive_mines/satchel_charges, null, VENDOR_ITEM_RECOMMENDED),
list("Sandbags x25", 10, /obj/item/stack/sandbags_empty/half, null, VENDOR_ITEM_RECOMMENDED),
list("Super-Capacity Power Cell", 10, /obj/item/cell/super, null, VENDOR_ITEM_REGULAR),
list("ES-11 Mobile Fuel Canister", 4, /obj/item/tool/weldpack/minitank, null, VENDOR_ITEM_REGULAR),
Expand Down
135 changes: 135 additions & 0 deletions code/game/objects/items/explosives/explosive.dm
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,138 @@
falloff_mode = EXPLOSION_FALLOFF_SHAPE_LINEAR
to_chat(usr, SPAN_NOTICE("You disable [src]'s blast wave dampener, restoring the blast radius to full."))
playsound(loc, 'sound/items/Screwdriver2.ogg', 25, 0, 6)
/obj/item/satchel_charge_detonator
name = "M38-D Multipurpose Detonator"
desc = "An ergonomic detonator capable of detonating multiple types of command explosives, notable being satchel charges, detcords and plastic explosives."
icon = 'icons/obj/items/weapons/grenade.dmi'
icon_state = "detonator"

var/list/linked_charges = list()
// list of linked explosives to handle

/obj/item/satchel_charge_detonator/attack_self(mob/user, parameters) // when attackl_self, detonate charges
. = ..()
flick("detonator_active", src)
sleep(40)
var/detonation_count = 0
for(var/obj/item/explosive/satchel_charge/SC in linked_charges)
if(SC.z != src.loc.z)
message_admins("")
SC.detonate(src)
detonation_count++
to_chat(user, SPAN_NOTICE("[detonation_count] charges detonated."))

/obj/item/satchel_charge_detonator/clicked(mob/user, list/mods) // kill me
if (isobserver(user) || isxeno(user)) return

if (mods["alt"]) // alt+click to ping charges?
to_chat(SPAN_NOTICE("You ping the detonator's [length(linked_charges)] linked charges."))
for(var/obj/item/explosive/satchel_charge/SC in linked_charges)
flick("satchel_primed", SC)
SC.beep(TRUE)
return 1
return
/obj/item/explosive/satchel_charge
name = "M17 Satchel Charge"
desc = "The M17 is an old, yet robust satchel charge system dating back to the late 21st century that still hasn't been replaced yet. In addition to command detonation, it also features a laser tripwire mode where it can be mounted onto a wall and detonate to anything the crosses it without IFF. Finally it features a seldomly used auto disarm mode where it automatically disarms after a time period to reduce collateral damage from UXO. Not that collateral matters nowadays anyways...\nTo detonate it, it requires linking with the included M38-D universal detonator beforehand and tossing it ."
//desc = "After linked to a detonator, and thrown, will become primed and able to be detonated."
gender = PLURAL
icon = 'icons/obj/items/weapons/grenade.dmi'
icon_state = "satchel"
flags_item = NOBLUDGEON
w_class = SIZE_SMALL
max_container_volume = 180
reaction_limits = list( "max_ex_power" = 260, "base_ex_falloff" = 90, "max_ex_shards" = 64,
"max_fire_rad" = 6, "max_fire_int" = 26, "max_fire_dur" = 30,
"min_fire_rad" = 2, "min_fire_int" = 4, "min_fire_dur" = 5
)

var/prime_time = 3 SECONDS
var/prime_timer = null
var/obj/item/satchel_charge_detonator/linked_detonator = null
var/activated = FALSE
var/armed = FALSE

/obj/item/explosive/satchel_charge/attack_self(mob/user)
. = ..()
if(!linked_detonator)
to_chat(user, SPAN_NOTICE("This Charge is not linked to any detonator"))
return
icon_state = "satchel_primed"
playsound(src.loc, 'sound/machines/click.ogg', 25, 1)
var/mob/living/carbon/C = user
if(istype(C) && !C.throw_mode)
C.toggle_throw_mode(THROW_MODE_NORMAL)
to_chat(user, SPAN_NOTICE("You activate the M17 Satchel Charge, it will now arm itself after a short time once thrown."))
activated = TRUE
addtimer(CALLBACK(src, .proc/un_activate), 10 SECONDS, TIMER_UNIQUE)

/obj/item/explosive/satchel_charge/attackby(obj/item/W, mob/user)
. = ..()
beep(TRUE)
if(armed)
to_chat(user, SPAN_WARNING("This charge is armed, its linking cannot be altered unless disarmed."))
return
if(!istype(W, /obj/item/satchel_charge_detonator))
return
var/obj/item/satchel_charge_detonator/D = W
if(linked_detonator == D)
D.linked_charges -= src
linked_detonator = null
to_chat(user, SPAN_NOTICE("You unlink the charge from the detonator."))
icon_state = "satchel"
else
D.linked_charges |= src
linked_detonator = D
to_chat(user, SPAN_NOTICE("The detonator indicates a new charge has been linked."))
icon_state = "satchel_linked"

/obj/item/explosive/satchel_charge/proc/un_activate()
if(activated)
activated = FALSE
if(linked_detonator)
icon_state = "satchel_linked"
else
icon_state = "satchel"

/obj/item/explosive/satchel_charge/throw_atom(atom/target, range, speed, atom/thrower, spin, launch_type, pass_flags)
. = ..()
dir = get_dir(src, thrower)
if(activated && linked_detonator)
icon_state = "satchel_primed"
prime_timer = addtimer(CALLBACK(src, .proc/arm), prime_time , TIMER_UNIQUE)
beep()

/obj/item/explosive/satchel_charge/proc/beep(beep_once)
playsound(src.loc, 'sound/weapons/mine_tripped.ogg', 10, 1)
to_chat(world, "BEEP")
if(!armed && beep_once != TRUE)
addtimer(CALLBACK(src, .proc/beep), 1 SECONDS, TIMER_UNIQUE)


/obj/item/explosive/satchel_charge/proc/arm()
activated = FALSE
if(!linked_detonator || armed)
return
icon_state = "satchel_armed"
armed = TRUE

/obj/item/explosive/satchel_charge/pickup(mob/user)
if(armed)
do_after(user, prime_time , INTERRUPT_MOVED, TRUE)
if(linked_detonator)
icon_state = "satchel_linked"
else
icon_state = "satchel"
armed = FALSE
. = ..()
else
. = ..()

/obj/item/explosive/satchel_charge/proc/detonate(triggerer)
if(!armed || linked_detonator != triggerer)
return
linked_detonator.linked_charges -= src
cell_explosion(loc, 120, 30, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, cause_data)
message_admins("BOOM!")
qdel(src)
13 changes: 13 additions & 0 deletions code/game/objects/items/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,19 @@
for(var/i in 1 to 5)
new /obj/item/explosive/mine/pmc(src)

/obj/item/storage/box/explosive_mines/satchel_charges
name = "\improper M17 satchel charge box"
desc = "A secure box holding five M17 satchel charges."
can_hold = list(/obj/item/explosive/satchel_charge,
/obj/item/satchel_charge_detonator,
)

/obj/item/storage/box/explosive_mines/satchel_charges/fill_preset_inventory()
new /obj/item/satchel_charge_detonator(src)
for(var/i in 1 to 5)
new /obj/item/explosive/satchel_charge(src)


/obj/item/storage/box/m94
name = "\improper M94 marking flare pack"
desc = "A packet of eight M94 Marking Flares. Carried by USCM soldiers to light dark areas that cannot be reached with the usual TNR Shoulder Lamp."
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/storage/pouch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@
/obj/item/explosive/plastic,
/obj/item/explosive/mine,
/obj/item/explosive/grenade,
/obj/item/explosive/satchel_charge,
/obj/item/satchel_charge_detonator,
)

/obj/item/storage/pouch/explosive/attackby(obj/item/W, mob/user)
Expand Down
Binary file modified icons/obj/items/weapons/grenade.dmi
Binary file not shown.

0 comments on commit 10fbfeb

Please sign in to comment.