limit modification options or a file that shows limits

Post Reply
midnight109
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Thu Jun 27, 2013 3:59 pm
Contact:

limit modification options or a file that shows limits

Post by midnight109 »

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

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)
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

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: limit modification options or a file that shows limits

Post by kovarex »

midnight109 wrote: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 :)
The limit is there for obvious reasons (to know how far for pole does it have sense to search when you build something), but the limit could be simply dynamically set by the pole with maximum area.
In other words, you won't have to think about it. (will be added to 0.6)
midnight109 wrote: 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)
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
In other words, you want to have something like LuaPrototype, it will have information about the type of the entity (name, effectivity, reach, max health etc.).
We plan to add it (but I can't say if in 0.6 or 0.7)

midnight109
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Thu Jun 27, 2013 3:59 pm
Contact:

Re: limit modification options or a file that shows limits

Post by midnight109 »

The limit is there for obvious reasons (to know how far for pole does it have sense to search when you build something), but the limit could be simply dynamically set by the pole with maximum area.
In other words, you won't have to think about it. (will be added to 0.6)
Well there is obvious reasons to devs :) But for a normal person without the full source view harder to see probomatic areas are where code would run amuck with diffrent types of info. On C++ code using a decimal interger in this function and latter someone changes a value above 9.0 the whole thing blows up if the lengeth or size is at max using the decimal spaces, but without seeing the original int command no one would know for example.

Limits are in everything for lots of reasons, just like the health is limited and max entities/sprites handeled at a time ect. Knowing what the limits are can be usefull for a modder, as well as regular ppl that dont mod, well not regular ppl but geeky ppl like me that like tearing things apart and blowing them up o_o

You included a file in either base or core with some of your presetup return values looks like for diffrent things, like if your facing this way the code returns this number, having a similier file or the same file that has the limits put in even if thier hard coded and just thier for a reffrence guide as you go :) Over all Its a wicked awsome....... and freaking adictive game :/ evilness so bloody addicting >.>
In other words, you want to have something like LuaPrototype, it will have information about the type of the entity (name, effectivity, reach, max health etc.).
We plan to add it (but I can't say if in 0.6 or 0.7)
Kinda, but more like 2 options, a localized and a globalized. One for the certain entity in the example above as when you build the entity, giving the script a option to modify data based on other things, like a realizsm mod might say ok you put this steam generator in the desert, so it will be easier to heat up the water, or you put this assembly plant in the desert its efficency goes down to X because all the sand and the extra heat and a global so you can add research mods that can modify all buildings that are built with that setup, or a simple function to do the modify for you so you dont have to create it all internaly just base areas and add functions to modify all, like modify_all_entities_by_type("lab") or my variable like effiency

Phantasm
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Sun Jul 07, 2013 1:48 pm
Contact:

Re: limit modification options or a file that shows limits

Post by Phantasm »

There could be both hard and soft limit. Soft limits gets dynamically adjusted depending on what is used by current mods. While hard limit is some sanity limit that mods can't overdo to make the game borked or very slow. However, the hard limit should just limit the value instead of crashing when going over it. It could show a notice about it though.

Post Reply

Return to “Implemented mod requests”