From c7d894f06901feaa2d577c4d3c18dddae3f4c97d Mon Sep 17 00:00:00 2001 From: skull132 Date: Mon, 22 May 2017 02:03:38 +0300 Subject: [PATCH] Fix mining runtimes (#2387) The wonders of "async" processing! --- code/modules/mining/mine_turfs.dm | 55 ++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/code/modules/mining/mine_turfs.dm b/code/modules/mining/mine_turfs.dm index 13b3a3a6697..ff84bfeb10a 100644 --- a/code/modules/mining/mine_turfs.dm +++ b/code/modules/mining/mine_turfs.dm @@ -180,6 +180,9 @@ var/obj/item/device/measuring_tape/P = W user.visible_message("[user] extends [P] towards [src].","You extend [P] towards [src].") if(do_after(user,25)) + if (!istype(src, /turf/simulated/mineral)) + return + user << "\icon[P] [src] has been excavated to a depth of [2*excavation_level]cm." return @@ -220,6 +223,9 @@ artifact_debris() if(do_after(user,P.digspeed)) + if (!istype(src, /turf/simulated/mineral)) + return + P.drilling = 0 if(prob(50)) @@ -292,6 +298,9 @@ if(!do_after(user,80)) return + if (!istype(src, /turf/simulated/mineral)) + return + user << "You finish chiselling [src] into a sculptable block." new /obj/structure/sculpting_block(src) GetDrilled(1) @@ -611,39 +620,46 @@ user << "You start digging deeper." playsound(user.loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1) digging = 1 - if(!do_after(user,60)) - digging = 0 + if(!do_after(user, 60)) + if (istype(src, /turf/simulated/floor/asteroid)) + digging = 0 return + + // Turfs are special. They don't delete. So we need to check if it's + // still the same turf as before the sleep. + if (!istype(src, /turf/simulated/floor/asteroid)) + return + playsound(user.loc, 'sound/effects/stonedoor_openclose.ogg', 50, 1) if(prob(33)) switch(dug) if(1) - user << " You've made a little progress." + user << "You've made a little progress." if(2) - user << " You notice the hole is a little deeper." + user << "You notice the hole is a little deeper." if(3) - user << " You think you're about halfway there." + user << "You think you're about halfway there." if(4) - user << " You finish up lifting another pile of dirt." + user << "You finish up lifting another pile of dirt." if(5) - user << " You dig a bit deeper. You're definitely halfway there now." + user << "You dig a bit deeper. You're definitely halfway there now." if(6) - user << " You still have a ways to go." + user << "You still have a ways to go." if(7) - user << " The hole looks pretty deep now." + user << "The hole looks pretty deep now." if(8) - user << " The ground is starting to feel a lot looser." + user << "The ground is starting to feel a lot looser." if(9) - user << " You can almost see the other side." + user << "You can almost see the other side." if(10) - user << " Just a little deeper. . ." + user << "Just a little deeper. . ." else - user << " You penetrate the virgin earth!" + user << "You penetrate the virgin earth!" else if(dug <= 10) - user << " You dig a little deeper." + user << "You dig a little deeper." else - user << " You dug a big hole." + user << "You dug a big hole." gets_dug() digging = 0 @@ -654,11 +670,18 @@ digging = 1 if(!do_after(user,40)) - digging = 0 + if (istype(src, /turf/simulated/floor/asteroid)) + digging = 0 + return + + // Turfs are special. They don't delete. So we need to check if it's + // still the same turf as before the sleep. + if (!istype(src, /turf/simulated/floor/asteroid)) return user << " You dug a hole." digging = 0 + gets_dug() else if(istype(W,/obj/item/weapon/storage/bag/ore))