private void CustomTick(object sender, ElapsedEventArgs e) { if (!this.Enabled) { return; } int mult = 1; int unitstosend = 8; pullcounter++; if (pullcounter >= 30) // dont pull item into its internal inventory too often to reduce lag { this.LinkedStorage.MoveAsManyItemsAsPossible(Storage, this.OwnerUser); pullcounter = 0; } IEnumerable <ItemStack> nonempty = Storage.NonEmptyStacks; nonempty.ForEach(stack => { int stackbefore = stack.Quantity; if (stack.Item.IsCarried) { mult = 5; } else { mult = 1; // transport less carried items per second than normal ones, maybe restrict based on mass? } if (unitstosend / mult < 1) { return; } outputWire.SendItemConsume(stack, unitstosend / mult); // thats where the items will be sent over the syste, unitstosend -= (stackbefore - stack.Quantity) * mult; if (stack.Quantity <= 0) { Storage.AddItem(stack.Item); Storage.RemoveItem(stack.Item.Type); } }); }
private void CustomTick(object sender, ElapsedEventArgs e) { if (!this.Enabled) { return; } int mult = 1; int unitstosend = 8; pullcounter++; if (pullcounter >= 30) { this.LinkedStorage.MoveAsManyItemsAsPossible(Storage, this.OwnerUser); pullcounter = 0; } IEnumerable <ItemStack> nonempty = Storage.NonEmptyStacks; nonempty.ForEach(stack => { int stackbefore = stack.Quantity; if (stack.Item.IsCarried) { mult = 5; } else { mult = 1; } if (unitstosend / mult < 1) { return; } outputWire.SendItemConsume(stack, unitstosend / mult); unitstosend -= (stackbefore - stack.Quantity) * mult; if (stack.Quantity <= 0) { Storage.AddItem(stack.Item); Storage.RemoveItem(stack.Item.Type); } }); }