Page 1 of 1

How do I change a property of an entity type without using tables?

Posted: Tue Nov 06, 2018 12:31 am
by Jackalope_Gaming
I'm familiar enough with using

Code: Select all

for i,name in ipairs(insert table here)
to make a table of entities that I can then change properties of, but I'm having trouble finding a way to have it simply look at a type of entity and for all of those entities it will change a given property.

For what context it's worth, the intent is to create a mod in line with the proposed .17 plans to remove ingredient number restrictions on assemblers. Fixing the vanilla assemblers is quite easy, but I'd like a way to support assemblers from all mods and not have to go in and specifically define their names into a supported table.

How might I do that?

Re: How do I change a property of an entity type without using tables?

Posted: Tue Nov 06, 2018 6:05 am
by darkfrei
Jackalope_Gaming wrote:
Tue Nov 06, 2018 12:31 am
For what context it's worth, the intent is to create a mod in line with the proposed .17 plans to remove ingredient number restrictions on assemblers. Fixing the vanilla assemblers is quite easy, but I'd like a way to support assemblers from all mods and not have to go in and specifically define their names into a supported table.
Just so:

Code: Select all

for i, prot_type in pairs (data.raw) do
  for j, prototype in pairs (prot_type) do
    if prototype[my_prop] then
      -- change prototype
      prototype[my_prop] = "new parameter for existing one"
    end
  end
end
Or for assemblers only.