limit modification options or a file that shows limits
Posted: Wed Jul 03, 2013 4:37 pm
Some ideas I had just got put on the back burner as it seems the engine has a limit to things preset and its a pain to find these limits as you have to increase by one, run game, see if crashes, close, add another, rinse repeat.
For example the power pole/grid has a max value I assume to be 8, one larger then the stock substation. I was going to make a higher area that might provide a larger area with power, but also consume power to do it, but cant go much higher then the reg one.
Adding a limits file, like a cfg file that shows all the limits/max vars of diffrent ones, so can open it up, look up your var, like max_supply_area_distance = 8 so you know not to go over 8
and adding the limits to each "type" for example if you are making a type solar-panel, these are vars usable thier values or max values, so you dont add things that the type dosent support or wont use the way intended, since some items for example thier energy means crafting speed not the energy the consume or produce so you know ahead of time or have a means of figuring out why things dont work as intended
Also easier access to view or modify entity data through the onbuiltentity event give direct access to everything about the newly built entity so if anything is needed by the mod can directly access it by a expanded data path like
So you can use a single event call to get all needed info about that event, in this case all the info on the item/entity/recipe/location can be accessed by one event instead of seeing if its triggered, looking at a var, then running a seperate set of commands or functions to poke around looking for the data the mod might need, as a example, using the createdentity i would be able to add a simple watch list, each time you build something and place on the map, the script checks for a type, grabs needed data on it only if its type or name is on the list, like the driller, then grab the info on its pos and its resource_searching_radius and its mining_speed to create a link to thebasic info on a custom table in the script, so every so often I could say ok run threw this table, each entry for the drills, get its posX,Y, search its resource_searching_radius around itself return the count of the search, do this with the results. I would think this would be more efficient since the code should already have all the info on what it just built to just link it over with the event results instead of running multi commands/functions to get the info already stored somewhere to keep cpu usage mini
For example the power pole/grid has a max value I assume to be 8, one larger then the stock substation. I was going to make a higher area that might provide a larger area with power, but also consume power to do it, but cant go much higher then the reg one.
Adding a limits file, like a cfg file that shows all the limits/max vars of diffrent ones, so can open it up, look up your var, like max_supply_area_distance = 8 so you know not to go over 8
and adding the limits to each "type" for example if you are making a type solar-panel, these are vars usable thier values or max values, so you dont add things that the type dosent support or wont use the way intended, since some items for example thier energy means crafting speed not the energy the consume or produce so you know ahead of time or have a means of figuring out why things dont work as intended

Also easier access to view or modify entity data through the onbuiltentity event give direct access to everything about the newly built entity so if anything is needed by the mod can directly access it by a expanded data path like
Code: Select all
game.onevent(defines.events.onbuiltentity, function(event)
if event.createdentity.name == "somename" then
local newEntityInfo.pos = event.createdentity.pos
local newEntityInfo.something = event.createdentity.something
local newEntityInfo.effectivness = event.createdentity.effectivness
local newEntityInfo.speed = event.createdentity.speed
local newEntityInfo.type = event.createdentity.type
.... use the vars
endend)