Attack Chain Migration: Grenades & Plastic Explosives (#31874)

* Update bomb.dm

* migration

* Fix CI

* Update mining_charges.dm

* Update deployable.dm
This commit is contained in:
CRUNCH
2026-04-21 04:58:44 +00:00
committed by GitHub
parent fd45dc8718
commit 3c1d985e31
10 changed files with 252 additions and 202 deletions
+66 -53
View File
@@ -8,7 +8,8 @@
det_time = 10
display_timer = FALSE
origin_tech = "syndicate=1"
var/atom/target = null
custom_activation = TRUE
var/atom/target_atom = null
var/image_overlay = null
var/obj/item/assembly/nadeassembly = null
var/assemblyattacher
@@ -28,30 +29,34 @@
/obj/item/grenade/plastic/Destroy()
QDEL_NULL(nadeassembly)
target = null
target_atom = null
plastic_overlay_target = null
return ..()
/obj/item/grenade/plastic/attackby__legacy__attackchain(obj/item/I, mob/user, params)
if(!nadeassembly && istype(I, /obj/item/assembly))
var/obj/item/assembly/A = I
/obj/item/grenade/plastic/wirecutter_act(mob/living/user, obj/item/used)
if(nadeassembly)
playsound(src, used.usesound, 20, 1)
nadeassembly.loc = get_turf(src)
nadeassembly.master = null
nadeassembly = null
update_icon(UPDATE_ICON_STATE)
return TRUE
/obj/item/grenade/plastic/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(!nadeassembly && istype(used, /obj/item/assembly))
var/obj/item/assembly/A = used
if(!user.transfer_item_to(A, src))
return ..()
nadeassembly = A
A.master = src
assemblyattacher = user.ckey
to_chat(user, SPAN_NOTICE("You add [A] to [src]."))
playsound(src, 'sound/weapons/tap.ogg', 20, 1)
update_icon(UPDATE_ICON_STATE)
return
if(nadeassembly && istype(I, /obj/item/wirecutters))
playsound(src, I.usesound, 20, 1)
nadeassembly.loc = get_turf(src)
nadeassembly.master = null
nadeassembly = null
update_icon(UPDATE_ICON_STATE)
return
..()
return ITEM_INTERACT_COMPLETE
return ..()
/obj/item/grenade/plastic/proc/on_atom_entered(datum/source, atom/movable/entered)
if(nadeassembly)
@@ -71,36 +76,43 @@
var/obj/item/assembly/voice/voice_analyzer = nadeassembly
voice_analyzer.hear_input(M, msg, 1)
/obj/item/grenade/plastic/attack_self__legacy__attackchain(mob/user)
/obj/item/grenade/plastic/activate_self(mob/user)
if(..())
return ITEM_INTERACT_COMPLETE
if(nadeassembly)
nadeassembly.attack_self__legacy__attackchain(user)
return
return ITEM_INTERACT_COMPLETE
var/newtime = input(usr, "Please set the timer.", "Timer", det_time) as num
if(user.is_in_active_hand(src))
newtime = clamp(newtime, 10, 60000)
det_time = newtime
to_chat(user, "Timer set for [det_time] seconds.")
return ITEM_INTERACT_COMPLETE
/obj/item/grenade/plastic/interact_with_atom(atom/target, mob/living/user, list/modifiers)
if(isstorage(target) || ismodcontrol(target))
return ..() // Let us not have people C4 themselves. Especially with a now 1.5 second do_after().
if(ismob(target))
if(isobserver(target))
to_chat(user, SPAN_WARNING("Your hand just phases through [target]!"))
return ITEM_INTERACT_COMPLETE
var/mob/M = target
if(M.stat == CONSCIOUS)
to_chat(user, SPAN_WARNING("You can't get the [src] to stick to [M]! Perhaps if [M] was asleep or dead you could attach it?"))
return ITEM_INTERACT_COMPLETE
/obj/item/grenade/plastic/afterattack__legacy__attackchain(mob/AM, mob/user, flag)
if(!flag)
return
if(ismob(AM) && AM.stat == CONSCIOUS)
to_chat(user, SPAN_WARNING("You can't get the [src] to stick to [AM]! Perhaps if [AM] was asleep or dead you could attach it?"))
return
if(isstorage(AM) || ismodcontrol(AM))
return ..() //Let us not have people c4 themselfs. Especially with a now 1.5 second do_after
if(isobserver(AM))
to_chat(user, SPAN_WARNING("Your hand just phases through [AM]!"))
return
to_chat(user, SPAN_NOTICE("You start planting [src].[isnull(nadeassembly) ? " The timer is set to [det_time]..." : ""]"))
if(do_after(user, 1.5 SECONDS * toolspeed, target = AM))
if(do_after(user, 1.5 SECONDS * toolspeed, target = target))
if(!user.unequip(src))
return
to_chat(user, SPAN_DANGER("[src] is stuck to your hand!"))
return ITEM_INTERACT_COMPLETE
target = AM
target_atom = target
loc = null
if(notify_admins)
message_admins("[ADMIN_LOOKUPFLW(user)] planted [name] on [target.name] at ([target.x],[target.y],[target.z] - <a href='byond://?_src_=holder;adminplayerobservecoodjump=1;X=[target.x];Y=[target.y];Z=[target.z]'>JMP</a>) with [det_time] second fuse", 0, 1)
log_game("[key_name(user)] planted [name] on [target.name] at ([target.x],[target.y],[target.z]) with [det_time] second fuse")
@@ -126,8 +138,9 @@
plastic_overlay_target.add_overlay(plastic_overlay)
if(!nadeassembly)
to_chat(user, SPAN_NOTICE("You plant the bomb. Timer counting down from [det_time]."))
to_chat(user, SPAN_DANGER("You plant the bomb. Timer counting down from [det_time]."))
addtimer(CALLBACK(src, PROC_REF(prime)), det_time SECONDS)
return ITEM_INTERACT_COMPLETE
/obj/item/grenade/plastic/suicide_act(mob/user)
message_admins("[key_name_admin(user)]([ADMIN_QUE(user,"?")]) ([ADMIN_FLW(user,"FLW")]) suicided with [src.name] at ([user.x],[user.y],[user.z] - <A href='byond://?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)",0,1)
@@ -150,7 +163,7 @@
else if(role == SPECIAL_ROLE_DEATHSQUAD || role == ROLE_ERT)
message_say = "FOR NANOTRASEN!"
user.say(message_say)
target = user
target_atom = user
sleep(10)
prime()
user.gib()
@@ -184,9 +197,9 @@
. = ..()
desc += SPAN_NOTICE("<br><b>Use [src] in-hand</b> to adjust the detonation timer.")
/obj/item/grenade/plastic/c4/afterattack__legacy__attackchain(atom/movable/AM, mob/user, flag)
aim_dir = get_dir(user, AM)
..()
/obj/item/grenade/plastic/c4/interact_with_atom(atom/target, mob/living/user, list/modifiers)
aim_dir = get_dir(user, target)
return ..()
/obj/item/grenade/plastic/c4/prime()
var/turf/location
@@ -194,14 +207,14 @@
plastic_overlay_target.cut_overlay(plastic_overlay, TRUE)
if(istype(plastic_overlay_target, /obj/effect/plastic))
qdel(plastic_overlay_target)
if(target)
if(!QDELETED(target))
location = get_turf(target)
if(!ex_breach && iswallturf(target)) //Walls get dismantled instead of destroyed to avoid making unwanted holes to space.
var/turf/simulated/wall/W = target
if(target_atom)
if(!QDELETED(target_atom))
location = get_turf(target_atom)
if(!ex_breach && iswallturf(target_atom)) //Walls get dismantled instead of destroyed to avoid making unwanted holes to space.
var/turf/simulated/wall/W = target_atom
W.dismantle_wall(TRUE, TRUE)
else
target.ex_act(EXPLODE_DEVASTATE)
target_atom.ex_act(EXPLODE_DEVASTATE)
else
location = get_turf(src)
if(location)
@@ -238,10 +251,10 @@
/obj/item/grenade/plastic/c4/shaped/flash/prime()
var/turf/T
if(target && target.density)
T = get_step(get_turf(target), aim_dir)
else if(target)
T = get_turf(target)
if(target_atom && target_atom.density)
T = get_step(get_turf(target_atom), aim_dir)
else if(target_atom)
T = get_turf(target_atom)
else
T = get_turf(src)
@@ -263,15 +276,15 @@
plastic_overlay_target.cut_overlay(plastic_overlay, TRUE)
if(istype(plastic_overlay_target, /obj/effect/plastic))
qdel(plastic_overlay_target)
if(target)
if(!QDELETED(target))
location = get_turf(target)
if(target_atom)
if(!QDELETED(target_atom))
location = get_turf(target_atom)
else
location = get_turf(src)
if(location)
var/datum/effect_system/smoke_spread/smoke = new
smoke.set_up(8, FALSE, location, aim_dir)
if(target && target.density)
if(target_atom && target_atom.density)
var/turf/T = get_step(location, aim_dir)
for(var/turf/simulated/wall/W in range(1, location))
W.thermitemelt(speed = 30)
@@ -282,8 +295,8 @@
addtimer(CALLBACK(null, GLOBAL_PROC_REF(explosion), T, 0, 0, 2), 3)
addtimer(CALLBACK(smoke, TYPE_PROC_REF(/datum/effect_system/smoke_spread, start)), 3)
if(isliving(target))
var/mob/living/M = target
if(isliving(target_atom))
var/mob/living/M = target_atom
M.adjust_fire_stacks(2)
M.IgniteMob()
qdel(src)