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

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Jackalope_Gaming
Fast Inserter
Fast Inserter
Posts: 230
Joined: Wed Oct 07, 2015 10:11 pm
Contact:

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

Post 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?

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2904
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

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

Post 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.

Post Reply

Return to “Modding help”