From 88e6bf82d53efab60da0fe6ad792cab3a081e1e6 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Sat, 17 Jun 2017 15:32:35 -0500 Subject: [PATCH] adds proper gibtonite detonation timing (#1462) --- code/modules/mining/ores_coins.dm | 38 ++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index fb3bbbd032..9d8b5aa5dd 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -1,3 +1,8 @@ + +#define GIBTONITE_QUALITY_HIGH 3 +#define GIBTONITE_QUALITY_MEDIUM 2 +#define GIBTONITE_QUALITY_LOW 1 + /**********************Mineral ores**************************/ /obj/item/weapon/ore @@ -184,10 +189,11 @@ item_state = "Gibtonite ore" w_class = WEIGHT_CLASS_BULKY throw_range = 0 - var/primed = 0 + var/primed = FALSE var/det_time = 100 - var/quality = 1 //How pure this gibtonite is, determines the explosion produced by it and is derived from the det_time of the rock wall it was taken from, higher value = better + var/quality = GIBTONITE_QUALITY_LOW //How pure this gibtonite is, determines the explosion produced by it and is derived from the det_time of the rock wall it was taken from, higher value = better var/attacher = "UNKNOWN" + var/det_timer /obj/item/weapon/twohanded/required/gibtonite/Destroy() qdel(wires) @@ -213,10 +219,12 @@ return if(primed) if(istype(I, /obj/item/device/mining_scanner) || istype(I, /obj/item/device/t_scanner/adv_mining_scanner) || istype(I, /obj/item/device/multitool)) - primed = 0 + primed = FALSE + if(det_timer) + deltimer(det_timer) user.visible_message("The chain reaction was stopped! ...The ore's quality looks diminished.", "You stopped the chain reaction. ...The ore's quality looks diminished.") icon_state = "Gibtonite ore" - quality = 1 + quality = GIBTONITE_QUALITY_LOW return ..() @@ -237,8 +245,8 @@ /obj/item/weapon/twohanded/required/gibtonite/proc/GibtoniteReaction(mob/user, triggered_by = 0) if(!primed) + primed = TRUE playsound(src,'sound/effects/hit_on_shattered_glass.ogg',50,1) - primed = 1 icon_state = "Gibtonite active" var/turf/bombturf = get_turf(src) var/area/A = get_area(bombturf) @@ -260,14 +268,18 @@ else user.visible_message("[user] strikes \the [src], causing a chain reaction!", "You strike \the [src], causing a chain reaction.") log_game("[key_name(user)] has primed a [name] for detonation at [A][COORD(bombturf)]") - if(primed) - if(quality == 3) - explosion(src.loc,2,4,9,adminlog = notify_admins) - if(quality == 2) - explosion(src.loc,1,2,5,adminlog = notify_admins) - if(quality == 1) - explosion(src.loc,-1,1,3,adminlog = notify_admins) - qdel(src) + det_timer = addtimer(CALLBACK(src, .proc/detonate, notify_admins), det_time, TIMER_STOPPABLE) + +/obj/item/weapon/twohanded/required/gibtonite/proc/detonate(notify_admins) + if(primed) + switch(quality) + if(GIBTONITE_QUALITY_HIGH) + explosion(src,2,4,9,adminlog = notify_admins) + if(GIBTONITE_QUALITY_MEDIUM) + explosion(src,1,2,5,adminlog = notify_admins) + if(GIBTONITE_QUALITY_LOW) + explosion(src,0,1,3,adminlog = notify_admins) + qdel(src) /obj/item/weapon/ore/Initialize() ..()