mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-08-27 07:08:22 +01:00
Merge pull request #8504 from Atermonera/c420
C4 still explodes if the turf its placed upon changes
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
var/datum/wires/explosive/c4/wires = null
|
||||
var/timer = 10
|
||||
var/atom/target = null
|
||||
var/list/location = list()
|
||||
var/open_panel = 0
|
||||
var/image_overlay = null
|
||||
var/blast_dev = -1
|
||||
@@ -53,9 +54,9 @@
|
||||
to_chat(user, "Planting explosives...")
|
||||
user.do_attack_animation(target)
|
||||
|
||||
if(do_after(user, 50) && in_range(user, target))
|
||||
if(do_after(user, 5 SECONDS) && in_range(user, target))
|
||||
user.drop_item()
|
||||
src.target = target
|
||||
set_target(target) // Saving coordinates in case the reference becomes invalid
|
||||
loc = null
|
||||
|
||||
if (ismob(target))
|
||||
@@ -67,16 +68,25 @@
|
||||
|
||||
target.overlays += image_overlay
|
||||
to_chat(user, "Bomb has been planted. Timer counting down from [timer].")
|
||||
spawn(timer*10)
|
||||
explode(get_turf(target))
|
||||
addtimer(CALLBACK(src, .proc/detonate), timer SECONDS)
|
||||
|
||||
/obj/item/weapon/plastique/proc/explode(var/location)
|
||||
/obj/item/weapon/plastique/proc/set_target(var/atom/T)
|
||||
if(!isatom(T))
|
||||
return
|
||||
target = T
|
||||
location = list(T.x, T.y, T.z)
|
||||
|
||||
/obj/item/weapon/plastique/proc/detonate()
|
||||
if(!target)
|
||||
target = get_atom_on_turf(src)
|
||||
if(!target)
|
||||
target = src
|
||||
if(location)
|
||||
explosion(location, blast_dev, blast_heavy, blast_light, blast_flash)
|
||||
|
||||
var/turf/T = get_turf(target)
|
||||
if (!T && length(location))
|
||||
T = locate(location[1], location[2], location[3])
|
||||
if (T)
|
||||
explosion(T, blast_dev, blast_heavy, blast_light, blast_flash)
|
||||
|
||||
if(target)
|
||||
if (istype(target, /turf/simulated/wall))
|
||||
|
||||
Reference in New Issue
Block a user