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

Satchel Charges #6924

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
41e48e3
aaaaaaaaaa
LynxSolstice Apr 1, 2023
2fe23cd
Merge remote-tracking branch 'upstream'
LynxSolstice Apr 1, 2023
6f4420e
Merge remote-tracking branch 'upstream'
LynxSolstice Apr 16, 2023
be7d95e
Merge remote-tracking branch 'upstream'
LynxSolstice Apr 20, 2023
2de2b0b
Merge remote-tracking branch 'upstream/master'
LynxSolstice May 21, 2023
942919a
Merge remote-tracking branch 'upstream'
LynxSolstice Feb 4, 2024
08990e2
Merge remote-tracking branch 'upstream'
LynxSolstice Aug 9, 2024
3243470
Merge remote-tracking branch 'upstream'
LynxSolstice Aug 11, 2024
0e1745d
Merge remote-tracking branch 'upstream'
LynxSolstice Aug 11, 2024
10fbfeb
Initial commit
LynxSolstice Aug 11, 2024
ffde800
Linters + lowering the amount of charges per box
LynxSolstice Aug 11, 2024
38e082d
Linters? Maybe?
LynxSolstice Aug 11, 2024
85c89f9
Linters!!
LynxSolstice Aug 11, 2024
d2b5d65
Linters please???
LynxSolstice Aug 11, 2024
5fd6604
Slowed the flashing of the warning to 3 ticks, the same as the other …
LynxSolstice Aug 11, 2024
959cb94
Adds req variant of a satchel charge box (3x) and ups the cost of the…
LynxSolstice Aug 12, 2024
cf09495
stashing for testing
LynxSolstice Aug 12, 2024
f3a2408
Merge branch 'master' into Satchel-Charges-take-two
LynxSolstice Aug 12, 2024
a401836
Code stuff
LynxSolstice Aug 12, 2024
20cdcd2
Merge branch 'Satchel-Charges-take-two' of https://github.com/LynxSol…
LynxSolstice Aug 12, 2024
a0843f3
lore desc change
LynxSolstice Aug 12, 2024
371e22e
Lore desc modified
LynxSolstice Aug 12, 2024
faf6d28
lore desc modification
LynxSolstice Aug 12, 2024
6b23152
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
1b3b933
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
29e17ff
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
d62c2e8
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
844ed9d
Merge branch 'master' into Satchel-Charges-take-two
LynxSolstice Aug 13, 2024
1ff004a
Adds more storage to the box
LynxSolstice Aug 13, 2024
dac0cb1
Code fix
LynxSolstice Aug 13, 2024
f524162
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
875a39f
CODE comments
LynxSolstice Aug 13, 2024
956206b
Merge branch 'Satchel-Charges-take-two' of https://github.com/LynxSol…
LynxSolstice Aug 13, 2024
47406dc
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
6e26b5b
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
7e03bcf
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
6b00e56
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
c1afeeb
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
af895f7
Merge branch 'master' into Satchel-Charges-take-two
LynxSolstice Aug 13, 2024
a6bb360
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 13, 2024
1ba2600
adds anti-grief
LynxSolstice Aug 14, 2024
d9bba4f
Merge branch 'Satchel-Charges-take-two' of https://github.com/LynxSol…
LynxSolstice Aug 14, 2024
f491eef
Update code/game/objects/items/explosives/explosive.dm
LynxSolstice Aug 14, 2024
a882431
Apply suggestions from code review
kiVts Aug 14, 2024
19d9519
Commits suggestions.
LynxSolstice Aug 15, 2024
8a659f2
price change
LynxSolstice Aug 15, 2024
e436005
Gives SLs and TLs the satchel charges for increased price.
LynxSolstice Aug 15, 2024
82269cf
detonator small
LynxSolstice Aug 15, 2024
9389ede
Adds loose charges and detonators to the req vendor
LynxSolstice Aug 15, 2024
8c93d98
Merge remote-tracking branch 'upstream' into Satchel-Charges-take-two
LynxSolstice Oct 13, 2024
769d8a8
Merge branch 'master' into Satchel-Charges-take-two
LynxSolstice Oct 13, 2024
2265f3c
CI
LynxSolstice Oct 13, 2024
9e8df9d
requested features pushed, added box sprites
LynxSolstice Oct 17, 2024
6fbe65a
Adds handling sounds for the satchel charges and detonator, courtesy …
LynxSolstice Oct 17, 2024
bbb9225
icons
LynxSolstice Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 (x3 charges, 1x detonator)", floor(scale), /obj/item/storage/box/explosive_mines/satchel_charges/req, 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)", 30, /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
155 changes: 155 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,158 @@
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"

LynxSolstice marked this conversation as resolved.
Show resolved Hide resolved
/// list of linked explosives to handle
var/list/linked_charges = list()
kiVts marked this conversation as resolved.
Show resolved Hide resolved
var/pressed = FALSE

/obj/item/satchel_charge_detonator/attack_self(mob/user, parameters) // when attackl_self, detonate charges
. = ..()
to_chat(user, SPAN_BOLDWARNING("You hold down the detonator button."))
if(pressed)
return
pressed = TRUE
flick("detonator_active", src)
sleep(40)
LynxSolstice marked this conversation as resolved.
Show resolved Hide resolved
pressed = FALSE
var/detonation_count = 0
for(var/obj/item/explosive/satchel_charge/charges in linked_charges)
if(charges.detonate(src))
detonation_count++
to_chat(user, SPAN_NOTICE("[src] reported [detonation_count] charge[detonation_count > 1 ? "s" : ""] 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(user, SPAN_NOTICE("You ping the detonator's [length(linked_charges)] linked charges."))
for(var/obj/item/explosive/satchel_charge/charges in linked_charges)
flick("satchel_primed", charges)
charges.beep(TRUE)
return TRUE
return

/obj/item/satchel_charge_detonator/Destroy()
for(var/obj/item/explosive/satchel_charge/charges in linked_charges)
charges.linked_detonator = null
linked_charges = null
return ..()

/obj/item/explosive/satchel_charge
name = "M17 Satchel Charge"
desc = "After linked to a detonator, and thrown, will become primed and able to be detonated."
desc_lore = "The M17 is a simple satchel charge system used by Marines in situations where their usual fire support can't reach, designed to be thrown at or into structures before exploding. This one is set to automatically disarm after a short period, to reduce the chances of civilian injuries from abandoned UXO.\nTo detonate it, link the satchel charge with the included M38-D universal detonator beforehand, then throw it. The detonator's safety mechanism takes four seconds to deactivate after being thrown."
gender = PLURAL
icon = 'icons/obj/items/weapons/grenade.dmi'
icon_state = "satchel"
flags_item = NOBLUDGEON
w_class = SIZE_SMALL
LynxSolstice marked this conversation as resolved.
Show resolved Hide resolved
antigrief_protection = TRUE
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
kiVts marked this conversation as resolved.
Show resolved Hide resolved
var/activated = FALSE
var/armed = FALSE

/obj/item/explosive/satchel_charge/attack_self(mob/user)
. = ..()
if(antigrief_protection && user.faction == FACTION_MARINE && explosive_antigrief_check(src, user))
to_chat(user, SPAN_WARNING("[name]'s safe-area accident inhibitor prevents you from planting it!"))
msg_admin_niche("[key_name(user)] attempted to prime \a [name] in [get_area(src)] [ADMIN_JMP(src.loc)]")
return
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/living_carbon = user
if(istype(living_carbon) && !living_carbon.throw_mode)
living_carbon.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."))
kiVts marked this conversation as resolved.
Show resolved Hide resolved
activated = TRUE
addtimer(CALLBACK(src, PROC_REF(un_activate)), 10 SECONDS, TIMER_UNIQUE)

/obj/item/explosive/satchel_charge/attackby(obj/item/weapon_thing, 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(weapon_thing, /obj/item/satchel_charge_detonator))
return
var/obj/item/satchel_charge_detonator/detonator = weapon_thing
if(linked_detonator == detonator)
detonator.linked_charges -= src
linked_detonator = null
to_chat(user, SPAN_NOTICE("You unlink the charge from [detonator]."))
icon_state = "satchel"
else
linked_detonator?.linked_charges -= src
detonator.linked_charges |= src
linked_detonator = detonator
to_chat(user, SPAN_NOTICE("[detonator] indicates a new charge has been linked."))
icon_state = "satchel_linked"

/obj/item/explosive/satchel_charge/proc/un_activate()
if(activated)
activated = FALSE
kiVts marked this conversation as resolved.
Show resolved Hide resolved
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_REF(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)
if(!armed && beep_once != TRUE)
addtimer(CALLBACK(src, PROC_REF(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)
if(linked_detonator)
icon_state = "satchel_linked"
else
icon_state = "satchel"
armed = FALSE
kiVts marked this conversation as resolved.
Show resolved Hide resolved
return ..()

/obj/item/explosive/satchel_charge/proc/detonate(triggerer)
if(!armed || linked_detonator != triggerer)
return FALSE
cell_explosion(loc, 120, 30, EXPLOSION_FALLOFF_SHAPE_LINEAR, null, cause_data)
qdel(src)
return TRUE

/obj/item/explosive/satchel_charge/Destroy()
linked_detonator?.linked_charges -= src
linked_detonator = null
return ..()

23 changes: 23 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,29 @@
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 (x5)"
desc = "A secure box holding five M17 satchel charges."
LynxSolstice marked this conversation as resolved.
Show resolved Hide resolved
max_storage_space = 16
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/explosive_mines/satchel_charges/req
name = "\improper M17 satchel charge box (x3)"
desc = "A secure box holding three M17 satchel charges."

/obj/item/storage/box/explosive_mines/satchel_charges/req/fill_preset_inventory()
new /obj/item/satchel_charge_detonator(src)
for(var/i in 1 to 3)
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.
Loading