diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index 1991f40d9f1..f2eaaaf0ce8 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -1,6 +1,6 @@ //conveyor2 is pretty much like the original, except it supports corners, but not diverters. //note that corner pieces transfer stuff clockwise when running forward, and anti-clockwise backwards. - +#define MAX_CONVEYOR_ITEMS_MOVE 30 GLOBAL_LIST_EMPTY(conveyors_by_id) /obj/machinery/conveyor @@ -19,6 +19,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) var/id = "" // the control ID - must match controller ID var/verted = 1 // Inverts the direction the conveyor belt moves. speed_process = TRUE + var/conveying = FALSE /obj/machinery/conveyor/centcom_auto id = "round_end_belt" @@ -127,16 +128,29 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) /obj/machinery/conveyor/process() if(stat & (BROKEN | NOPOWER)) return - if(!operating) + //If the conveyor is broken or already moving items + if(!operating || conveying) return use_power(6) - affecting = loc.contents - src // moved items will be all in loc + //get the first 30 items in contents + var/i = 0 + for(var/item in loc.contents) + if(item == src) + continue + i++ // we're sure it's a real target to move at this point + if(i >= MAX_CONVEYOR_ITEMS_MOVE) + break + affecting.Add(item) + conveying = TRUE addtimer(CALLBACK(src, .proc/convey, affecting), 1) /obj/machinery/conveyor/proc/convey(list/affecting) for(var/atom/movable/A in affecting) - if((A.loc == loc) && A.has_gravity()) + if(!QDELETED(A) && (A.loc == loc)) A.ConveyorMove(movedir) + //Give this a chance to yield if the server is busy + stoplag() + conveying = FALSE // attack with item, place item on conveyor /obj/machinery/conveyor/attackby(obj/item/I, mob/user, params) @@ -398,3 +412,5 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) /obj/item/paper/guides/conveyor name = "paper- 'Nano-it-up U-build series, #9: Build your very own conveyor belt, in SPACE'" info = "

Congratulations!

You are now the proud owner of the best conveyor set available for space mail order! We at Nano-it-up know you love to prepare your own structures without wasting time, so we have devised a special streamlined assembly procedure that puts all other mail-order products to shame!

Firstly, you need to link the conveyor switch assembly to each of the conveyor belt assemblies. After doing so, you simply need to install the belt assemblies onto the floor, et voila, belt built. Our special Nano-it-up smart switch will detected any linked assemblies as far as the eye can see! This convenience, you can only have it when you Nano-it-up. Stay nano!

" + +#undef MAX_CONVEYOR_ITEMS_MOVE