Hello,
I'd like to report that https://lua-api.factorio.com/latest/Lua ... slot_count is reading always ZERO for requester chests.
I think with the 1.1 update, it broke the value being written in request_slot_count, now I cannot figure out a way to iterate over the requester chest slots, since I cannot just go iterating and catch an error so it stops.
I think since the change on how requester chests works (to be dynamic slots), it's reading always zero for the moment.
[1.1] BUG: LuaEntity.request_slot_count always read 0
Re: [1.1] BUG: LuaEntity.request_slot_count always read 0
It only reads 0 when it has no requests configured, which is weird.
Re: [1.1] BUG: LuaEntity.request_slot_count always read 0
it is always set to the configured request with the highest index/slot.
If you want to do something to configured request that should be enough.
if you want to set requests then just iterate over your data and use set/clear_request_slot accordingly.
Factorio will auto expand the slots when using set_request_slot()
Edit:
Actually found a nice short example in my mod (it deals with the spidertron and not requester chests, but that shouldn't matter i think)
set_request()/clear() are LuaEntity.set/clear_vehicle_request_slot calls
If you want to do something to configured request that should be enough.
Code: Select all
for i=1, request_slot_count do
--guaranteed to encouter every
end
Factorio will auto expand the slots when using set_request_slot()
Edit:
Actually found a nice short example in my mod (it deals with the spidertron and not requester chests, but that shouldn't matter i think)
set_request()/clear() are LuaEntity.set/clear_vehicle_request_slot calls
Code: Select all
for i = 1, requests.max_slot do --max_slot is NOT the set to request_slot_count (could be >100 or whatever)
if config[i] then --config is created/stored via the mod and contains requests to set
set_request(i, config[i])
else
clear(i)
end
end
Re: [1.1] BUG: LuaEntity.request_slot_count always read 0
'request_slot_count ()'
returns the highest configured request slot...
there might be empty ones before, thou
returns the highest configured request slot...
there might be empty ones before, thou
Re: [1.1] BUG: LuaEntity.request_slot_count always read 0
I just ran into this... was never noted in the changelog D:< . There's also no read on the prototype's max slots. I wanted the "last slot" for my mod, so for now I'm going with 20 (end of default second row) unless someone has a better idea.
I have mods! I guess!
Link
Link
Re: [1.1] BUG: LuaEntity.request_slot_count always read 0
The prototype has no max request, the number of requests is not limited
Internally, the max slot index is 1000
You can write to any slot you up to that and the GUI will adjust
Re: [1.1] BUG: LuaEntity.request_slot_count always read 0
Is the wiki inaccurate then?
https://wiki.factorio.com/Prototype/LogisticContainer
Code: Select all
max_logistic_slots
Type: uint16
The number of request slots this logistics container has. Requester-type containers must have > 0 slots and can have a maximum of 1000 slots. Storage-type containers must have <= 1 slot.
I have mods! I guess!
Link
Link