How to make a new science pack?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
firestar246
Inserter
Inserter
Posts: 29
Joined: Sun Feb 19, 2017 11:25 am
Contact:

How to make a new science pack?

Post by firestar246 »

So I wanted to make a new science pack. I copied science pack 1, changed the name, graphics, and recipe , but it isn't showing up on the laboratories screen. Is there something else I have to do?


Thanks!
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. For the wages of sin is death; but the gift of God is eternal life through Jesus Christ our Lord.

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

Re: How to make a new science pack?

Post by darkfrei »

firestar246 wrote:So I wanted to make a new science pack. I copied science pack 1, changed the name, graphics, and recipe , but it isn't showing up on the laboratories screen. Is there something else I have to do?


Thanks!

Code: Select all

data.raw.lab.lab.inputs[1] = "science-pack-1"
data.raw.lab.lab.inputs[2] = "science-pack-2"
data.raw.lab.lab.inputs[3] = "science-pack-3"
data.raw.lab.lab.inputs[4] = "military-science-pack"
data.raw.lab.lab.inputs[5] = "production-science-pack"
data.raw.lab.lab.inputs[6] = "high-tech-science-pack"
data.raw.lab.lab.inputs[7] = "space-science-pack"
Add here your item.

User avatar
firestar246
Inserter
Inserter
Posts: 29
Joined: Sun Feb 19, 2017 11:25 am
Contact:

Re: How to make a new science pack?

Post by firestar246 »

darkfrei wrote:
firestar246 wrote:So I wanted to make a new science pack. I copied science pack 1, changed the name, graphics, and recipe , but it isn't showing up on the laboratories screen. Is there something else I have to do?


Thanks!

Code: Select all

data.raw.lab.lab.inputs[1] = "science-pack-1"
data.raw.lab.lab.inputs[2] = "science-pack-2"
data.raw.lab.lab.inputs[3] = "science-pack-3"
data.raw.lab.lab.inputs[4] = "military-science-pack"
data.raw.lab.lab.inputs[5] = "production-science-pack"
data.raw.lab.lab.inputs[6] = "high-tech-science-pack"
data.raw.lab.lab.inputs[7] = "space-science-pack"
Add here your item.
Thanks for helping me again! Out of curiosity, what would happen if I had this mod and another mod on at the same time that added an 8th input to the lab? Would they conflict or would the game fix it somehow? Just curios...
For by grace are ye saved through faith, and that not of yourselves: it is the gift of God: Not of works, lest any man should boast. For the wages of sin is death; but the gift of God is eternal life through Jesus Christ our Lord.

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: How to make a new science pack?

Post by Arch666Angel »

Code: Select all

table.insert(data.raw["lab"]["lab"].inputs, "your-science-pack")

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: How to make a new science pack?

Post by bobingabout »

firestar246 wrote:
darkfrei wrote:
firestar246 wrote:So I wanted to make a new science pack. I copied science pack 1, changed the name, graphics, and recipe , but it isn't showing up on the laboratories screen. Is there something else I have to do?


Thanks!

Code: Select all

data.raw.lab.lab.inputs[1] = "science-pack-1"
data.raw.lab.lab.inputs[2] = "science-pack-2"
data.raw.lab.lab.inputs[3] = "science-pack-3"
data.raw.lab.lab.inputs[4] = "military-science-pack"
data.raw.lab.lab.inputs[5] = "production-science-pack"
data.raw.lab.lab.inputs[6] = "high-tech-science-pack"
data.raw.lab.lab.inputs[7] = "space-science-pack"
Add here your item.
Thanks for helping me again! Out of curiosity, what would happen if I had this mod and another mod on at the same time that added an 8th input to the lab? Would they conflict or would the game fix it somehow? Just curios...
Yeah, he gave you bad advice. this isn't an array, it's a table, you don't need to specifically reference each item by it's index number to add a new one, simply table.insert. Like what angel posted.
Arch666Angel wrote:

Code: Select all

table.insert(data.raw["lab"]["lab"].inputs, "your-science-pack")
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

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

Re: How to make a new science pack?

Post by darkfrei »

bobingabout wrote:
firestar246 wrote:
darkfrei wrote:
firestar246 wrote:So I wanted to make a new science pack. I copied science pack 1, changed the name, graphics, and recipe , but it isn't showing up on the laboratories screen. Is there something else I have to do?


Thanks!

Code: Select all

data.raw.lab.lab.inputs[1] = "science-pack-1"
data.raw.lab.lab.inputs[2] = "science-pack-2"
data.raw.lab.lab.inputs[3] = "science-pack-3"
data.raw.lab.lab.inputs[4] = "military-science-pack"
data.raw.lab.lab.inputs[5] = "production-science-pack"
data.raw.lab.lab.inputs[6] = "high-tech-science-pack"
data.raw.lab.lab.inputs[7] = "space-science-pack"
Add here your item.
Thanks for helping me again! Out of curiosity, what would happen if I had this mod and another mod on at the same time that added an 8th input to the lab? Would they conflict or would the game fix it somehow? Just curios...
Yeah, he gave you bad advice. this isn't an array, it's a table, you don't need to specifically reference each item by it's index number to add a new one, simply table.insert. Like what angel posted.
Arch666Angel wrote:

Code: Select all

table.insert(data.raw["lab"]["lab"].inputs, "your-science-pack")
All is table in lua. Of coarse new value must be added to inputs with function table.insert. https://www.lua.org/pil/19.2.html
And vanilla inputs can be written as list:

Code: Select all

data.raw.lab.lab.inputs = {"science-pack-1", "science-pack-2", "science-pack-3", "military-science-pack", "production-science-pack",  "high-tech-science-pack", "space-science-pack"}
There is no different between this code and code above.

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: How to make a new science pack?

Post by Arch666Angel »

There is a significant one: Table.insert appends your argument to the end of the existing table, what you do is override the whole table with your new definition.

Post Reply

Return to “Modding help”