[Mod 0.11.22] CyberChest 0.9.0

Topics and discussion about specific mods
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

[Mod 0.11.22] CyberChest 0.9.0

Post by SigmatroN »

Image
Cyberchest is a smart chest, addition to an assembling machine that enables whole production chains maid with a single machine.
Just build it right next to an assembler, set up the chain, put raw components in and let it do the rest.

BASIC INSTRUCTIONS
Research technology "Cyberchests" (needs "Advanced electronics")
1. Build a chest and an assembler next to each other.
2. Open the chest and set items to be produced in the Logistics menu (Keep the right order of recipes!).
3. Press Start/Pause button in GUI

Compatible with any assembling machine types from any mods!
Multiplayer compatible!
BASIC INSTRUCTIONS IMAGES
ADVANCED INSTRUCTIONS
Update 0.6.0
Update 0.7.0
Update 0.8.0
Update 0.9.0
Spotlight by Klonan: https://youtu.be/rl3X16YOcJ8

v. 0.9.0
v. 0.8.0
v. 0.7.0
v. 0.6.0
v. 0.5.0

Acknowledgements
YuokiTani, for letting me use some of his graphics.
Klonan, for making the spotlight

If you have any questions or suggestions, post them below!
Last edited by SigmatroN on Wed Jun 10, 2015 11:22 am, edited 17 times in total.
BrkDmrkn

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by BrkDmrkn »

Game doesn't detect the mod. :( Sounds awesome though!
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by SigmatroN »

BrkDmrkn wrote:Game doesn't detect the mod. :( Sounds awesome though!
W-what? Are you sure, you put it in the right folder, and run game of version 11.22? Does something similar happen with any other mod?
BrkDmrkn

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by BrkDmrkn »

SigmatroN wrote:
BrkDmrkn wrote:Game doesn't detect the mod. :( Sounds awesome though!
W-what? Are you sure, you put it in the right folder, and run game of version 11.22? Does something similar happen with any other mod?
I am playing with other mods so i know i put it on the correct folder. My game is 11.22 and no, something like this has never happened before. If this happens only to me i am going to be quite sad. :(
other mods i am using
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by SigmatroN »

What do you mean by "detect"? Not showing it on the mod list?
BrkDmrkn

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by BrkDmrkn »

SigmatroN wrote:What do you mean by "detect"? Not showing it on the mod list?
Yes. It's not showing on the mod list and there is no item in game either.
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by SigmatroN »

Well, the item should not be in the game right away. First there is a tech. But mod not showing up? Really strange. In fact this is the first time I heard such kind of issue with any mod ever.
Try renaming folder of CyberChest, let's see if game shows any error.
Lonewolf
Inserter
Inserter
Posts: 33
Joined: Sun Aug 10, 2014 1:23 pm
Contact:

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by Lonewolf »

I'm guessing he placed the rar file in the mods directory but the game reads only zip? So unpacking it will most likely solve it.

It is showing up in my game anyway (after unpacking the rar file)
daniel34
Global Moderator
Global Moderator
Posts: 2761
Joined: Thu Dec 25, 2014 7:30 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by daniel34 »

Lonewolf wrote:I'm guessing he placed the rar file in the mods directory but the game reads only zip? So unpacking it will most likely solved it
Just wanted to post that. The download is a .rar-Archive, and on systems that have an extractor that can read rar (like WinRAR) the symbol is the same as for zip. I didn't even notice it was a rar, until I extracted it and then the mod was detected.
@SigmatroN: please pack your mod into a .zip-File instead of .rar, so you don't need to install WinRAR or other tools to extract it, also the .zip is automatically detected by Factorio.

EDIT: Just tried the mod on an existing save that has several mods already, and the GUI doesn't pop up when opening the CyberChest, so I can't click the Start/Pause button.
I do have the upgrade planner mod installed and it adds a GUI, maybe that's why your GUI doesn't show.
quick links: log file | graphical issues | wiki
BrkDmrkn

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by BrkDmrkn »

daniel34 wrote:
Lonewolf wrote:I'm guessing he placed the rar file in the mods directory but the game reads only zip? So unpacking it will most likely solved it
Just wanted to post that. The download is a .rar-Archive, and on systems that have an extractor that can read rar (like WinRAR) the symbol is the same as for zip. I didn't even notice it was a rar, until I extracted it and then the mod was detected.
@SigmatroN: please pack your mod into a .zip-File instead of .rar, so you don't need to install WinRAR or other tools to extract it, also the .zip is automatically detected by Factorio.

EDIT: Just tried the mod on an existing save that has several mods already, and the GUI doesn't pop up when opening the CyberChest, so I can't click the Start/Pause button.
I do have the upgrade planner mod installed and it adds a GUI, maybe that's why your GUI doesn't show.
Wow im surprised i didn't notice it was a rar... Thanks for pointing that out!
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.5.0

Post by SigmatroN »

daniel34 wrote:
Lonewolf wrote:I'm guessing he placed the rar file in the mods directory but the game reads only zip? So unpacking it will most likely solved it
Just wanted to post that. The download is a .rar-Archive, and on systems that have an extractor that can read rar (like WinRAR) the symbol is the same as for zip. I didn't even notice it was a rar, until I extracted it and then the mod was detected.
@SigmatroN: please pack your mod into a .zip-File instead of .rar, so you don't need to install WinRAR or other tools to extract it, also the .zip is automatically detected by Factorio.

EDIT: Just tried the mod on an existing save that has several mods already, and the GUI doesn't pop up when opening the CyberChest, so I can't click the Start/Pause button.
I do have the upgrade planner mod installed and it adds a GUI, maybe that's why your GUI doesn't show.
Thanks for the advice! I'll look into that issue. Does the GUI work fine without mods?
Edit: Well, I just have started fresh game with some mods and test mode. Upgrade planner mod GUI does not seem to interfere with mine.. as well as the FARL's. I can even open all three at once.
Any other suggestions, clues?
I've used glob.gui to store my GUI. As far as I know, every mod has it's own glob table.. am I correct? If not, try to rename all "glob.gui" in control.lua into.. say "glob.gui_1".
User avatar
darkshadow1809
Filter Inserter
Filter Inserter
Posts: 306
Joined: Thu Jan 15, 2015 10:13 pm
Contact:

Re: [Mod 0.11.22] CyberChest 0.6.0

Post by darkshadow1809 »

awh man. This is AWESOME :d ! Can I put it in the modpack :) ? Credits will be ofcourse added!
ShadowsModpackDevelopment
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.6.0

Post by SigmatroN »

darkshadow1809 wrote:awh man. This is AWESOME :d ! Can I put it in the modpack :) ? Credits will be ofcourse added!
Sure.
scitor
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu May 28, 2015 12:40 pm
Contact:

Re: [Mod 0.11.22] CyberChest 0.6.0

Post by scitor »

This mod is so awesome, it just reduced my assembly lines to a fraction of the space needed before.

I've got a few questions though and a bug to report.

The bug is kind of annoying as it happend to me a few times already and it just closes the current game, without saving anything! :twisted:
How to reproduce
The questions:
a) I've noticed that the Cyberchests act like Requester Chests to the Logistics network. That's really cool as I can let it request even the base materials. But I tried to produce some items that I already had in my logistics network and the robots kept filling the chest with the (intermediate) products. Is there a way I can prevent this? The problem is in a few cases that produced a loop without crafting anything. I tried it by moving the chest out of the logistics range, but that means I can't use it as Requester Chest for the base materials. It would be nice to be able to disable the Logistics functionality (entirely or maybe per slot?), so that I can insert any base material manually. Or maybe multiple tiers which you'd have to research,w ith a basic version and an advanced requester version, just an idea ;)

b) When I use inserters to fetch out the end product, it doesn't honor the "Reserved Slot" setting. As I understand it the Cyberchest will always leave one of a kind in itself but that doesn't seem to affect other machines accessing its inventory. Maybe the chest could "report" just one item less than it's actually holding, to prevent inserters from removing all of the products. (On the other hand, to remove specific items I need a smart inserter anyway, so the only thing that would save would be the red/green wire to detect the contents).

Thanks for this small but powerful mod, already using it where I can :D
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.6.0

Post by SigmatroN »

scitor wrote:This mod is so awesome, it just reduced my assembly lines to a fraction of the space needed before.

I've got a few questions though and a bug to report.

The bug is kind of annoying as it happend to me a few times already and it just closes the current game, without saving anything! :twisted:
How to reproduce
The questions:
a) I've noticed that the Cyberchests act like Requester Chests to the Logistics network. That's really cool as I can let it request even the base materials. But I tried to produce some items that I already had in my logistics network and the robots kept filling the chest with the (intermediate) products. Is there a way I can prevent this? The problem is in a few cases that produced a loop without crafting anything. I tried it by moving the chest out of the logistics range, but that means I can't use it as Requester Chest for the base materials. It would be nice to be able to disable the Logistics functionality (entirely or maybe per slot?), so that I can insert any base material manually. Or maybe multiple tiers which you'd have to research,w ith a basic version and an advanced requester version, just an idea ;)

b) When I use inserters to fetch out the end product, it doesn't honor the "Reserved Slot" setting. As I understand it the Cyberchest will always leave one of a kind in itself but that doesn't seem to affect other machines accessing its inventory. Maybe the chest could "report" just one item less than it's actually holding, to prevent inserters from removing all of the products. (On the other hand, to remove specific items I need a smart inserter anyway, so the only thing that would save would be the red/green wire to detect the contents).

Thanks for this small but powerful mod, already using it where I can :D
Thanks for the report. I think, I fixed this bug for new mod version.
a) I defined cyber chest as a requester chest with a sole purpose - to use it's convenient GUI. And, unfortunately, there is no way to disable requester abilities. So, I pointed out that it was useless as a requester in the original post, Advanced Instructions chapter. However, I slightly altered the logic, so now it should work as you described (i.e wait for the gauge to fill and go on). And there is a way now, not a very reliable one, however, to use it as a requester. (Guess yourself how :D )

b) It's a partially resolved issue now. Now you need only smart inserter (and no wires) to fetch the products.
Nathan1852
Inserter
Inserter
Posts: 21
Joined: Mon Jun 09, 2014 5:59 pm
Contact:

Re: [Mod 0.11.22] CyberChest 0.7.0

Post by Nathan1852 »

Sadly it seems like the script used by the cyberchests is not very optimised. Could you look at it again?
2015-06-02_00003.jpg
2015-06-02_00003.jpg (691.69 KiB) Viewed 15804 times
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.7.0

Post by SigmatroN »

Nathan1852 wrote:Sadly it seems like the script used by the cyberchests is not very optimised. Could you look at it again?
2015-06-02_00003.jpg
How many chests do you have, exactly?
Nathan1852
Inserter
Inserter
Posts: 21
Joined: Mon Jun 09, 2014 5:59 pm
Contact:

Re: [Mod 0.11.22] CyberChest 0.7.0

Post by Nathan1852 »

I have four chests.

EDIT: The fix isn't working atm, I'm working on it

I experimented a little bit and it seems like I found a fix by changing the start of cyberchest.initialize_assembler to this:

Code: Select all

function cyberchest.initialize_assembler(self)
	local recipe_name = self:getorder().name
	self._actnumber = 1
	self.all_in_place = true
...
Changing the cyberchest.wait_for_ingredients function to this:

Code: Select all

function cyberchest.wait_for_ingredients(self)
	if not self.assembler.recipe then self:set_state_ready() end
	
	if not self.asm_out then
		self.asm_out = self.assembler.getinventory(defines.inventory.assemblingmachineoutput)
		self.asm_in = self.assembler.getinventory(defines.inventory.assemblingmachineinput)
		self.inv = self.entity.getinventory(defines.inventory.chest)	
		self.ing = ingredients_to_simplestack(self.assembler.recipe.name)
	end
	
	if not self.asm_out.isempty() then --already contains results
		self.state = self.wait_for_output
		self.message = "Waiting for results.."
		--self:state()
	end
	
	local asm_in_count, needed_stack = {};
	local inv_count;
	
	
	self._itemnumber = #self.ing
	if self._actnumber == 1 then
		self:reset_bar()
	end
	--for _,item_stack in pairs(self.ing) do
	local num = self._itemnumber - self._actnumber > 2 and 2 or 1
	
	for i = self._actnumber, num do
		local item_stack = self.ing[i]
		asm_in_count = self.asm_in.getitemcount(item_stack.name)
		inv_count = self.inv.getitemcount(item_stack.name)
		if self.reserve_slots then
			inv_count = inv_count - 1 --reserve 1 item
		end
		
		if inv_count + asm_in_count < item_stack.count then
			needed_stack = {name = item_stack.name, count = item_stack.count - asm_in_count - inv_count} --only needed count
			if self.collect_from_ground and self.inv.caninsert(needed_stack) then --option, tech, space
				if self:collected_from_ground(needed_stack) then
					self.inv.insert(needed_stack)
					inv_count = inv_count + needed_stack.count
				else
					self.all_in_place = false
				end
			else
				self:restore_bar()
				return
			end
		end
	end
	self._actnumber = self._actnumber + num
	if self._actnumber >= self._itemnumber then
		self:restore_bar()
	
		if not self.all_in_place then
			if self.autoreset then --resets after 5 seconds
				self:autoreset_countdown()
			end
			return --not enough of something
		end
		self.autoreset_count = 30 --reset countdown
	
		--all in place
		for _,item_stack in pairs(self.ing) do
		--insert only needed count
			if item_stack.count > 0 then
				if not stack_transfer(self.inv, item_stack, self.assembler) then
					self.message = "Unknown error while trying to insert ingredients"
					return
				end
			end
		end
	end
	
	self.state = self.wait_for_output
	self.message = "Waiting for results.."
	--self:state()
end
And deleting every self:state() call exept in cyberchest.state_execute

This brings it down from 7.170 to about 0.5 and puts the FPS drops from 10 to a maximum of 1 every few seconds.
SigmatroN
Long Handed Inserter
Long Handed Inserter
Posts: 50
Joined: Sat Apr 26, 2014 8:31 am
Contact:

Re: [Mod 0.11.22] CyberChest 0.7.0

Post by SigmatroN »

Nathan1852 wrote:I have four chests.

EDIT: The fix isn't working atm, I'm working on it

I experimented a little bit and it seems like I found a fix by changing the start of cyberchest.initialize_assembler to this:

Code: Select all

function cyberchest.initialize_assembler(self)
	local recipe_name = self:getorder().name
	self._actnumber = 1
	self.all_in_place = true
...
Changing the cyberchest.wait_for_ingredients function to this:

Code: Select all


function cyberchest.wait_for_ingredients(self)
	if not self.assembler.recipe then self:set_state_ready() end
	
	if not self.asm_out then
		self.asm_out = self.assembler.getinventory(defines.inventory.assemblingmachineoutput)
		self.asm_in = self.assembler.getinventory(defines.inventory.assemblingmachineinput)
		self.inv = self.entity.getinventory(defines.inventory.chest)	
		self.ing = ingredients_to_simplestack(self.assembler.recipe.name)
	end
	
	if not self.asm_out.isempty() then --already contains results
		self.state = self.wait_for_output
		self.message = "Waiting for results.."
		--self:state()
	end
	
	local asm_in_count, needed_stack = {};
	local inv_count;
	
	
	self._itemnumber = #self.ing
	if self._actnumber == 1 then
		self:reset_bar()
	end
	--for _,item_stack in pairs(self.ing) do
	local num = self._itemnumber - self._actnumber > 2 and 2 or 1
	
	for i = self._actnumber, num do
		local item_stack = self.ing[i]
		asm_in_count = self.asm_in.getitemcount(item_stack.name)
		inv_count = self.inv.getitemcount(item_stack.name)
		if self.reserve_slots then
			inv_count = inv_count - 1 --reserve 1 item
		end
		
		if inv_count + asm_in_count < item_stack.count then
			needed_stack = {name = item_stack.name, count = item_stack.count - asm_in_count - inv_count} --only needed count
			if self.collect_from_ground and self.inv.caninsert(needed_stack) then --option, tech, space
				if self:collected_from_ground(needed_stack) then
					self.inv.insert(needed_stack)
					inv_count = inv_count + needed_stack.count
				else
					self.all_in_place = false
				end
			else
				self:restore_bar()
				return
			end
		end
	end
	self._actnumber = self._actnumber + num
	if self._actnumber >= self._itemnumber then
		self:restore_bar()
	
		if not self.all_in_place then
			if self.autoreset then --resets after 5 seconds
				self:autoreset_countdown()
			end
			return --not enough of something
		end
		self.autoreset_count = 30 --reset countdown
	
		--all in place
		for _,item_stack in pairs(self.ing) do
		--insert only needed count
			if item_stack.count > 0 then
				if not stack_transfer(self.inv, item_stack, self.assembler) then
					self.message = "Unknown error while trying to insert ingredients"
					return
				end
			end
		end
	end
	
	self.state = self.wait_for_output
	self.message = "Waiting for results.."
	--self:state()
end
And deleting every self:state() call exept in cyberchest.state_execute

This brings it down from 7.170 to about 0.5 and puts the FPS drops from 10 to a maximum of 1 every few seconds.
7 for 4? That's rough, I had 7 for 16.
I appreciate it, but what logic is behind that _actnumber? Also I put self:state() for a reason. To allow script to skip to the next stage and do not wait for another update. This allows assembler to produce 6 items per second instead of.. 1, i think.
Nathan1852
Inserter
Inserter
Posts: 21
Joined: Mon Jun 09, 2014 5:59 pm
Contact:

Re: [Mod 0.11.22] CyberChest 0.7.0

Post by Nathan1852 »

The problem with sels:state() is that it can cause many functioncalls after each other.
This wouldn't be a problem if some of the functions wouldn't take long to finish.
Post Reply

Return to “Mods”