requests regarding transport lines and belts
Posted: Wed Mar 23, 2016 2:43 pm
hi devs, hi modders!
i am suggesting the following api-improvements/api-changes regarding transport lines and belts:
a)
read access to belt speed.
i moved this one to its own request thread: viewtopic.php?f=28&t=23187
b)
where the key/the float ranges from 0 to 1 and signifies the position on this piece of transport line. The key to be the position on the line is crucial for us modders to be able to work by the principles of FIFO. I request the value to be LuaItemStack as i read and tested, that items on a belt can also be stacks of items. I dont know if single items are also a stack of size 1 or a LuaEntity. If so, the value can be either a LuaItemStack or a LuaEntity. Does not matter. Anyhow i request access to the entities of the items on the line, which are inaccessible at the moment. 
c)
This would extract the entity of a stack/item from the contents of a transport line and thus the item visible in game. The entity of the stack/item shall continue to exist, so it can be used somewhere else programmatically.
d)
where the float again signifies the position on this piece of line with a value ranging from 0 to 1. this will allow to insert an existing stack or item entity into the line.
e)
where the float again signifies the position on this piece of line with a value ranging from 0 to 1.Items will not be moved beyond this position on the transport line. nil signifies that the position was unset, ending any halting on that transport line. Please note, that i only request the method and the internal implementation to set that position and halt item flow there. I do not request the game engine saving this position/flag for every transport line in game. We can do that in the mods save data, when we subscribe to the associated event. and we can set it in on_load.
motivation:
opening up access to the entities on a belt, extraction and insertion, would allow a lot of new things to be done in mods. Items shuffled around on belts, between belts, from belts to other modded entities and back to belts. item flow halted when conditions are met or not. with the speed setting readable, the modded entities can adapt to the belts connected to them. (they easily could be modded belt entities with non-stock belt speeds. what to do then, if the speed is unknown?) and - imo very important - the mods can set its calculations to be performed only every n-th tick (depending on the speed of the belt) to keep strain on the game engine as low as possible.
What do you think?
i am suggesting the following api-improvements/api-changes regarding transport lines and belts:
a)
read access to belt speed.
i moved this one to its own request thread: viewtopic.php?f=28&t=23187
b)
Code: Select all
LuaTransportLine.get_content_entities :: dictionary float → LuaItemStack

c)
Code: Select all
LuaTransportLine.extract_content(LuaItemStack)
d)
Code: Select all
LuaTransportLine.insert_content_at_position(LuaItemStack, float)
and
LuaTransportLine.insert_content_at_back(LuaItemStack)
e)
Code: Select all
LuaTransportLine.halt_at_position(float or nil)
AND one of the events
script.on_transport_line_halting_position_set(LuaTransportLine, float or nil) (implemented as globally visible event)
or
LuaTransportLine.on_halting_position_set(float or nil) (implemented as event attached to a specific transport line entity)
motivation:
opening up access to the entities on a belt, extraction and insertion, would allow a lot of new things to be done in mods. Items shuffled around on belts, between belts, from belts to other modded entities and back to belts. item flow halted when conditions are met or not. with the speed setting readable, the modded entities can adapt to the belts connected to them. (they easily could be modded belt entities with non-stock belt speeds. what to do then, if the speed is unknown?) and - imo very important - the mods can set its calculations to be performed only every n-th tick (depending on the speed of the belt) to keep strain on the game engine as low as possible.
What do you think?