Adds busy to flatpack unpacking.

Stops you from spamming the same step to complete a flatpack quickly.
This commit is contained in:
ComicIronic
2014-12-05 21:40:18 +00:00
parent cef9eab4a7
commit 145bfbaf12

View File

@@ -7,7 +7,7 @@
anchored = 0
var/obj/machinery/machine = null
var/datum/construction/flatpack_unpack/unpacking
var/opening=0
var/opening = 0
var/assembling = 0
/obj/structure/closet/crate/flatpack/New()
@@ -17,6 +17,8 @@
/obj/structure/closet/crate/flatpack/attackby(var/atom/A, mob/user)
if(assembling)
if(unpacking.assemble_busy)
return
if(unpacking.action(A, user))
return 1
if(istype(A, /obj/item/weapon/crowbar) && !assembling)
@@ -24,7 +26,7 @@
user << "<span class='warning'>This is already being opened.</span>"
return 1
user <<"<span class='notice'>You begin to open the flatpack...</span>"
opening=1
opening = 1
if(do_after(user, rand(10,40)))
if(machine)
user <<"<span class='notice'>\icon [src]You successfully unpack \the [src]!</span>"
@@ -42,7 +44,7 @@
else
user <<"<span class='notice'>\icon [src]It seems this [src] was empty...</span>"
qdel(src)
opening=0
opening = 0
return
/obj/structure/closet/crate/flatpack/proc/Finalize()
@@ -57,6 +59,7 @@
/datum/construction/flatpack_unpack
steps = list()
var/assemble_busy = 0
/datum/construction/flatpack_unpack/New(var/atom/A)
var/last_step = ""
@@ -105,10 +108,13 @@
var/valid_step = is_right_key(user,used_atom)
if(valid_step)
if(custom_action(valid_step, used_atom, user))
assemble_busy = 1
if(do_after(user, 30))
assemble_busy = 0
var/list/step = steps[steps.len]
user << "You successfully [step["action"]] in the assembly."
next_step(user)
assemble_busy = 0
return 1
return 0