Jump to content

I've messed something up with factories, and I need help (please)


Azerik

Recommended Posts

I got an idea to expand the culinary offerings in Avorion to include pizza.  To that end I added in some stuff in goodsindex.lua and corresponding factories in productionsindex.lua.  When I put it up for testing, I keep getting an error with productions.lua

 

2017-11-26 10-46-55| could not execute function 'initialize' in '""':
2017-11-26 10-46-55| data/scripts/lib/productions.lua:41: bad argument #1 to 'pairs' (table expected, got nil)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[C]: in function 'pairs'
2017-11-26 10-46-55| 	data/scripts/lib/productions.lua:41: in main chunk
2017-11-26 10-46-55| 	[C]: in function 'require'
2017-11-26 10-46-55| 	data/scripts/sectors/miningfield.lua:5: in main chunk
2017-11-26 10-46-55| 	[C]: in function 'require'
2017-11-26 10-46-55| 	data/scripts/sectorspecifics.lua:30: in function 'addTemplate'
2017-11-26 10-46-55| 	data/scripts/sectorspecifics.lua:55: in function 'addTemplates'
2017-11-26 10-46-55| 	data/scripts/sectorspecifics.lua:191: in function 'initialize'
2017-11-26 10-46-55| 	data/scripts/sectorspecifics.lua:23: in function <data/scripts/sectorspecifics.lua:18>
2017-11-26 10-46-55| 	(...tail calls...)
2017-11-26 10-46-55| 	[string "..."]:10: in function <[string "..."]:8>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| could not execute function 'name' in '""':
2017-11-26 10-46-55| [string "..."]:17: attempt to index upvalue 'specs' (a nil value)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[string "..."]:17: in function <[string "..."]:16>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| could not execute function 'regular' in '""':
2017-11-26 10-46-55| [string "..."]:21: attempt to index upvalue 'specs' (a nil value)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[string "..."]:21: in function <[string "..."]:20>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| could not execute function 'offgrid' in '""':
2017-11-26 10-46-55| [string "..."]:25: attempt to index upvalue 'specs' (a nil value)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[string "..."]:25: in function <[string "..."]:24>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| could not execute function 'dustyness' in '""':
2017-11-26 10-46-55| [string "..."]:29: attempt to index upvalue 'specs' (a nil value)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[string "..."]:29: in function <[string "..."]:28>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| could not execute function 'getScript' in '""':
2017-11-26 10-46-55| [string "..."]:37: attempt to index upvalue 'specs' (a nil value)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[string "..."]:37: in function <[string "..."]:36>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| could not execute function 'gates' in '""':
2017-11-26 10-46-55| [string "..."]:33: attempt to index upvalue 'specs' (a nil value)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[string "..."]:33: in function <[string "..."]:32>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| could not execute function 'generatePlanets' in '""':
2017-11-26 10-46-55| [string "..."]:41: attempt to index upvalue 'specs' (a nil value)
2017-11-26 10-46-55| stack traceback:
2017-11-26 10-46-55| 	[string "..."]:41: in function <[string "..."]:40>
2017-11-26 10-46-55| 
2017-11-26 10-46-55| Player logged in: initsuj, index: 4911
2017-11-26 10-46-55| Error while adding file "data/scripts/entity/merchants/factory.lua":
2017-11-26 10-46-55| 
2017-11-26 10-46-55| data/scripts/lib/productions.lua:41: bad argument #1 to 'pairs' (table expected, got nil) 
2017-11-26 10-46-56| Error while adding file "data/scripts/entity/merchants/factory.lua":
2017-11-26 10-46-56| 
2017-11-26 10-46-56| data/scripts/lib/productions.lua:41: bad argument #1 to 'pairs' (table expected, got nil) 
2017-11-26 10-46-56| Error while adding file "data/scripts/entity/merchants/factory.lua":
2017-11-26 10-46-56| 
2017-11-26 10-46-56| data/scripts/lib/productions.lua:41: bad argument #1 to 'pairs' (table expected, got nil) 
2017-11-26 10-46-56| Error while adding file "data/scripts/entity/merchants/factory.lua":
2017-11-26 10-46-56| 
2017-11-26 10-46-56| data/scripts/lib/productions.lua:41: bad argument #1 to 'pairs' (table expected, got nil) 

 

I'm thinking it is in direct relation to something I've screwed up in either goodsindex or productionsindex.  But I've been over them and can't find where I messed up.  I did have a few mismatched brackets and other typos when I first rolled it out, but they were quickly fixed.  The only other weirdness I have is some not-"factory" names for things and comments in the file to mark out the changes.  Could the comments be doing it?

 

The only other thing I can think of is I have an "importance" or "level" assigned incorrectly.  Not completely understanding what those were doing, I mostly cloned my new goods from old things that were similar.  Minor adjustments to price and size were all I really did to that section.

 

Help?

 

goodsindex.lua

--Start of pizzaplus mod
goods["Anchovy"] = {name="Anchovy", plural="Anchovies", description="Fermented, pickled bait fish, suitable only as a cruel joke topping.", icon="data/textures/pizzaplus/icons/fried-fish.png", price=123, size=0.5, level=2, importance=0, illegal=false, dangerous=false, }
goods["Bacon"] = {name="Bacon", plural="Bacon", description="Alchemy in food form, the most magical product derived from pigs.", icon="data/textures/pizzaplus/icons/planks.png", price=46, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Cardboard"] = {name="Cardboard", plural="Cardboard", description="Strengthened paper product used in packaging.", icon="data/textures/pizzaplus/icons/folded-paper.png", price=56, size=1, level=2, importance=1, illegal=false, dangerous=false, }
goods["Cheese"] = {name="Cheese", plural="Cheese", description="Wheels of delicious cheese.", icon="data/textures/pizzaplus/icons/cheese-wedge.png", price=217, size=0.5, level=4, importance=1, illegal=false, dangerous=false, }
goods["Chicken"] = {name="Chicken", plural="Chickens", description="The pet that poops breakfast.", icon="data/textures/pizzaplus/icons/chicken.png", price=26, size=0.5, level=2, importance=2, illegal=false, dangerous=false, }
goods["Cooking Oil"] = {name="Cooking Oil", plural="Cooking Oil", description="A barrel of vegetable oil used for cooking food.", icon="data/textures/pizzaplus/icons/oil-drum.png", price=490, size=1, level=1, importance=4, illegal=false, dangerous=false, }
goods["Dough"] = {name="Dough", plural="Dough", description="A magical combinaion of protein rich flour, eggs, salt, and water.", icon="data/textures/pizzaplus/icons/dough-roller.png", price=79, size=0.5, level=2, importance=5, illegal=false, dangerous=false, }
goods["Egg"] = {name="Egg", plural="Eggs", description="Which came first, the chicken or the egg?", icon="data/textures/pizzaplus/icons/big-egg.png", price=70, size=2, level=0, importance=2, illegal=false, dangerous=false, }
goods["Garlic"] = {name="Garlic", plural="Garlic", description="A fragrant bulb that makes food worth eating.", icon="data/textures/pizzaplus/icons/garlic.png", price=291, size=0.3, level=5, importance=1, illegal=false, dangerous=false, }
goods["Gluten Free Vegan Pizza"] = {name="Gluten Free Vegan Pizza", plural="Gluten Free Vegan Pizza", description="If you think this is actually food...", icon="data/textures/pizzaplus/icons/turd.png", price=26, size=0.5, level=2, importance=0, illegal=false, dangerous=true, }
goods["Ham"] = {name="Ham", plural="Ham", description="The third most magical product derived from pigs.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=20, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Marniara Sauce"] = {name="Marinara Sauce", plural="Marinara Sauce", description="Tangy, herbed tomato sauce. Truly ambrosiacal application of tomatos.", icon="data/textures/icons/oil-drum.png", price=42, size=1, level=1, importance=2, illegal=false, dangerous=false, }
goods["Mushrooms"] = {name="Mushroom", plural="Mushrooms", description="A mushroom is the fleshy, spore-bearing fruiting body of a fungus.", icon="data/textures/icons/mushroom.png", price=45, size=1, level=3, importance=2, illegal=false, dangerous=false, }
goods["Pepperoni"] = {name="Pepperoni", plural="Pepperoni", description="Spiced, fermented sausage, the only *real* pizza topping.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=309, size=0.3, level=5, importance=1, illegal=false, dangerous=false, }
goods["Pineapple"] = {name="Pineapple", plural="Pineapples", description="The pineapple is a tropical plant with an edible multiple fruit consisting of coalesced berries.", icon="data/textures/pizzaplus/icons/pineapple.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
goods["Olives"] = {name="Olive", plural="Olives", description="A cured and fremented drupe from the olive tree.", icon="data/textures/pizzaplus/icons/olive.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
goods["Pig"] = {name="Pig", plural="Pigs", description="The omnivorous source of that most magical of foods, bacon.", icon="data/textures/pizzaplus/icons/pig.png", price=132, size=1, level=2, importance=2, illegal=false, dangerous=false, }
goods["Pork"] = {name="Pork", plural="Pork", description="Proto-bacon and proto-ham.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=17, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Self Heating Pizza Box"] = {name="Pizza Box", plural="Pizza Boxes", description="A high-tech, yet grease absorbing, self heating pizza box.", icon="data/textures/icons/cannister.png", price=308, size=0.75, level=5, importance=4, illegal=false, dangerous=false, }
goods["Self Heating Pizza"] = {name="Pizza", plural="Pizzas", description="A high tech, self-heating box pre-loaded with a delicious pizza.", icon="data/textures/pizzaplus/icons/pizza-slice.png", price=10741, size=2.5, level=6, importance=0, illegal=false, dangerous=false, }
goods["Soylent Green"] = {name="Soylent Green", plural="Soylent Green", description="Soylent Green is People!", icon="data/textures/icons/beams-aura.png", price=223, size=0.5, level=2, importance=0, illegal=false, dangerous=false, }
goods["Tomato"] = {name="Tomato", plural="Tomatos", description="A large, juicy tomato.", icon="data/textures/pizzaplus/icons/apple-seeds.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
--End of pizzaplus mod

 

productionsindex.lua

--PizzaPlus food production mod
table.insert(productions, {factory="${good} Farm ${size}", ingredients={}, results={{name="Egg", amount=5}}, garbages={{name="Chicken", amount=1}}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Dough", amount=1, optional=0}, {name="Marinara Sauce", amount=20, optional=0}, {name="Cheese", amount=10, optional=0}, {name="Self Heating Pizza Box", amount=10, optional=0}, {name="Pepperoni", amount=1, optional=1}, {name="Anchovy", amount=2, optional=1}, {name="Pineapple", amount=5, optional=1}, {name="Olives", amount=5, optional=1}, {name="Mushrooms", amount=10, optional=1}, {name="Ham", amount=10, optional=1}, {name="Bacon", amount=5, optional=1}}, {results={name="Self Heating Pizza", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Dairy", amount=5, optional=0}, {name="Chemicals", amount=1, optional=0}}, results={{name="Cheese", amount=3}}, garbages={{name="Water", amount=1}}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Wheat", amount=3, optional=0}, {name="Egg", amount=2, optional=0}, {name="Water", amount=1, optional=0}, {name="Fungus", amount=1, optional=0}}, results={{name="Dough", amount=5}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Tomato", amount=10, optional=0}, {name="Garlic", amount=2, optional=0}, {name="Spices", amount=1, optional=0}, {name="Mushrooms", amount=2, optional=0}}, results={{name="Marinara Sauce", amount=40}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=10, optional=0}, {name="Spices", amount=1, optional=0}, {name="Fungus", amount=1, optional=0}}, results={{name="Pepperoni", amount=3}}, garbages={}})
table.insert(productions, {factory="${good} Pickling Plant ${size}", ingredients={{name="Fish", amount=10, optional=0}, {name="Chemicals", amount=1, optional=0}, {name="Garlic", amount=3, optional=0}, {name="Cooking Oil", amount=1, optional=0}, {name="Spices", amount=1, optional=0}}, results={{name="Anchovy", amount=30}}, garbages={}})
table.insert(productions, {factory="${good} Extractor ${size}", ingredients={{name="Olives", amount=10, optional=0}, {name="Energy Cells", amount=1, optional=0}}, results={{name="Cooking Oil", amount=3}}, garbages={}})
table.insert(productions, {factory="${good} Assembly Plant ${size}", ingredients={{name="Cardboard", amount=1, optional=0}, {name="Energy Cell", amount=1, optional=0}, {name="Aluminum", amount=1, optional=0}, {name="Wire", amount=1, optional=0}}, results={{name="Self Heating Pizza Box", amount=2}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Paper", amount=1, optional=0}, {name="Adhesive", amount=1, optional=0}, {name="Wood", amount=1, optional=0}}, results={{name="Cardboard", amount=5}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=40, optional=0}, {name="Fertilizer", amount=1, optional=0}}, results={{name="Pineapple", amount=20}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=30, optional=0}, {name="Fertilizer", amount=5, optional=0}}, results={{name="Tomato", amount=40}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=40, optional=0}, {name="Fertilizer", amount=5, optional=0}}, results={{name="Mushroom", amount=60}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=30, optional=0}, {name="Fertilizer", amount=7, optional=0}}, results={{name="Olives", amount=45}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=1, optional=0}, {name="Water", amount=1, optional=0}}, results={{name="Garlic", amount=4}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Water", amount=1, optional=0}, {name="Corn", amount=1, optional=1}, {name="Vegetable", amount=1, optional=1}, {name="Rice", amount=1, optional=1}}, results={{name="Pig", amount=1}}, garbages={{name="Fertilizer", amount=1}}})
table.insert(productions, {factory="${good} Manufacturing Plant ${size}", ingredients={{name="Slave", amount=1, optional=0}, {name="Solvent", amount=1, optional=0}}, results={{name="Soylent Green", amount=100}}, garbages={}})
table.insert(productions, {factory="${good} Matrix ${size}", ingredients={{name="Slave", amount=1, optional=0}, {name="Wire", amount=1, optional=0}, {name="Morn Drug", amount=1, optional=0}}, results={{name="Energy Cells", amount=500}}, garbages={{name="Meat", amount=1}}})
table.insert(productions, {factory="${good} Processing Plant ${size}", ingredients={{name="Pig", amount=1, optional=0}, {name="Energy Cell", amount=1, optional=0}}, results={{name="Pork", amount=17}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=15, optional=0}, {name="Spices", amount=1, optional=0}, {name="Wood", amount=1, optional=0}, {name="Chemicals", amount=1, optional=0}, results={{name="Bacon", amount=35}}, garbages={}}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=2, optional=0}, {name="Water", amount=1, optional=0}, {name="Spices", amount=1, optional=0}}, results={{name="Ham", amount=26}}, garbages={}})
table.insert(productions, {factory="${good} Parlor ${size}", ingredients={{name="Toxic Waste", amount=1, optional=0}, {name="Fungus", amount=1, optional=0}, {name=""}}})

Link to comment
Share on other sites

I've chased it down more.  Turns out I'm not as good a typist as I thought.

I've had a myriad of typos, spelling error, and a couple {} mismatches.

 

I'm down to just trying to figure out why the actual pizza factory and the pizza box factory aren't working.  At the very least, I've re-learned proper testing procedures from all this.  Considering how out of date my coding skills are (30 years), I think I'm doing ok.

 

Thank you for the assistance, I literally couldn't have done it without you.  Hopefully I can figure out the final problems, if I can't, I'll be back with updates.

 

Link to comment
Share on other sites

I am puzzled.  The productions.lua error is gone.  I think that was some factories w/o ingredients/results.  I figured it was something I'd done in the productionsindex.lua.

 

I went through and added each new factory one at a time to find the other errors.

 

I can't seem to get the final two, the pizza box factory and the actual pizza factory.  When I originally made the pizza factory I had a lot of optional ingredients (the toppings).  Not wanting to chase through that, I fashioned a basic cheese pizza factory.  When I spawn in one of those, it looks fine.  The trade interface opens, there are amounts listed, the whole 9 yards.  Opening the console it is giving me a repeated error because Pizza Box isn't bought or sold (i'd paste the error, but it would mean uppng my logging level).  When I spawn in a box factory, it shows up as just "Station" and not as Pizza Box Factory like it should.  Also when I open it, the interface is blank for Buy/Sell Goods.  No buy tab, no sell tab, nothing listed, just empty window.

 

I originally started this as "Self-Heating Pizza Box" and have slowly migrated to just "Pizza Box" during trouble shooting.  In the interests of making sure I didn't have another typo, I actually ctrl-c copied the "Pizza Box" and pasted it into the box factory as the result, as an ingredient in the pizza factory, and in the goodsindex.lua.  But it keeps telling me that Pizza Box isn't bought or sold.

 

Relevant parts of the various files.

productionsindex.lua

-- This file was generated automatically with a tool.
productions = {}
--pizzaplus start
table.insert(productions, {factory="${good} Manufacturing Plant ${size}", ingredients={{name="Slave", amount=1, optional=0}, {name="Solvent", amount=1, optional=0}}, results={{name="Soylent Green", amount=100}}, garbages={}})
table.insert(productions, {factory="The Matrix ${size}", ingredients={{name="Slave", amount=1, optional=0}, {name="Wire", amount=1, optional=0}, {name="Morn Drug", amount=1, optional=0}}, results={{name="Energy Cell", amount=500}, {name="Meat", amount=1}}, garbages={}})
--table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Dough", amount=1, optional=0}, {name="Marinara Sauce", amount=20, optional=0}, {name="Cheese", amount=10, optional=0}, {name="Self Heating Pizza Box", amount=10, optional=0}, {name="Pepperoni", amount=1, optional=1}, {name="Anchovy", amount=2, optional=1}, {name="Pineapple", amount=5, optional=1}, {name="Olives", amount=5, optional=1}, {name="Mushrooms", amount=10, optional=1}, {name="Ham", amount=10, optional=1}, {name="Bacon", amount=5, optional=1}}, {results={name="Self Heating Pizza", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Cardboard", amount=1, optional=0}, {name="Energy Cell", amount=1, optional=0}, {name="Aluminum", amount=1, optional=0}, {name="Wire", amount=1, optional=0}}, results={{name="Pizza Box", amount=2}}, garbages={}})
table.insert(productions, {factory="Cheese Pizza Factory ${size}", ingredients={{name="Dough", amount=10, optional=0}, {name="Marinara Sauce", amount=20, optional=0}, {name="Cheese", amount=10, optional=0}, {name="Pizza Box", amount=10, optional=0}}, results={{name="Pizza", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Dairy", amount=5, optional=0}, {name="Chemicals", amount=1, optional=0}}, results={{name="Cheese", amount=3}}, garbages={{name="Water", amount=1}}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Wheat", amount=3, optional=0}, {name="Egg", amount=2, optional=0}, {name="Water", amount=1, optional=0}, {name="Fungus", amount=1, optional=0}}, results={{name="Dough", amount=5}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Tomato", amount=10, optional=0}, {name="Garlic", amount=2, optional=0}, {name="Spices", amount=1, optional=0}, {name="Mushrooms", amount=2, optional=0}}, results={{name="Marinara Sauce", amount=40}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=10, optional=0}, {name="Spices", amount=1, optional=0}, {name="Fungus", amount=1, optional=0}}, results={{name="Pepperoni", amount=3}}, garbages={}})
table.insert(productions, {factory="${good} Pickling Plant ${size}", ingredients={{name="Fish", amount=10, optional=0}, {name="Chemicals", amount=1, optional=0}, {name="Garlic", amount=3, optional=0}, {name="Cooking Oil", amount=1, optional=0}, {name="Spices", amount=1, optional=0}}, results={{name="Anchovy", amount=30}}, garbages={}})
table.insert(productions, {factory="${good} Extractor ${size}", ingredients={{name="Olives", amount=10, optional=0}, {name="Energy Cell", amount=1, optional=0}}, results={{name="Cooking Oil", amount=3}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Paper", amount=1, optional=0}, {name="Adhesive", amount=1, optional=0}, {name="Wood", amount=1, optional=0}}, results={{name="Cardboard", amount=5}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=1, optional=0}, {name="Corn", amount=3, optional=0}}, results={{name="Egg", amount=5}, {name="Chicken", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=40, optional=0}, {name="Fertilizer", amount=1, optional=0}}, results={{name="Pineapple", amount=20}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=30, optional=0}, {name="Fertilizer", amount=5, optional=0}}, results={{name="Tomato", amount=40}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=40, optional=0}, {name="Fertilizer", amount=5, optional=0}}, results={{name="Mushroom", amount=60}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=30, optional=0}, {name="Fertilizer", amount=7, optional=0}}, results={{name="Olives", amount=45}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=1, optional=0}, {name="Water", amount=1, optional=0}}, results={{name="Garlic", amount=4}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Water", amount=1, optional=0}, {name="Corn", amount=1, optional=1}, {name="Vegetable", amount=1, optional=1}, {name="Rice", amount=1, optional=1}}, results={{name="Pig", amount=1}}, garbages={{name="Fertilizer", amount=1}}})
table.insert(productions, {factory="${good} Processing Plant ${size}", ingredients={{name="Pig", amount=1, optional=0}, {name="Energy Cell", amount=1, optional=0}}, results={{name="Pork", amount=17}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=15, optional=0}, {name="Spices", amount=1, optional=0}, {name="Wood", amount=1, optional=0}, {name="Chemicals", amount=1, optional=0}}, results={{name="Bacon", amount=35}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=2, optional=0}, {name="Water", amount=1, optional=0}, {name="Spices", amount=1, optional=0}}, results={{name="Ham", amount=26}}, garbages={}})

 

goodsindex.lua

-- This file was generated automatically with a tool.
goods = {}
--Start of pizzaplus
goods["Anchovy"] = {name="Anchovy", plural="Anchovies", description="Fermented, pickled bait fish, suitable only as a cruel joke topping.", icon="data/textures/pizzaplus/icons/fried-fish.png", price=123, size=0.5, level=2, importance=0, illegal=false, dangerous=false, }
goods["Bacon"] = {name="Bacon", plural="Bacon", description="Alchemy in food form, the most magical product derived from pigs.", icon="data/textures/pizzaplus/icons/planks.png", price=46, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Cardboard"] = {name="Cardboard", plural="Cardboard", description="Strengthened paper product used in packaging.", icon="data/textures/pizzaplus/icons/folded-paper.png", price=56, size=1, level=2, importance=1, illegal=false, dangerous=false, }
goods["Cheese"] = {name="Cheese", plural="Cheese", description="Wheels of delicious cheese.", icon="data/textures/pizzaplus/icons/cheese-wedge.png", price=217, size=0.5, level=4, importance=1, illegal=false, dangerous=false, }
goods["Chicken"] = {name="Chicken", plural="Chickens", description="The pet that poops breakfast.", icon="data/textures/pizzaplus/icons/chicken.png", price=26, size=0.5, level=2, importance=2, illegal=false, dangerous=false, }
goods["Cooking Oil"] = {name="Cooking Oil", plural="Cooking Oil", description="A barrel of vegetable oil used for cooking food.", icon="data/textures/pizzaplus/icons/oil-drum.png", price=490, size=1, level=1, importance=4, illegal=false, dangerous=false, }
goods["Dough"] = {name="Dough", plural="Dough", description="A magical combinaion of protein rich flour, eggs, salt, and water.", icon="data/textures/pizzaplus/icons/dough-roller.png", price=79, size=0.5, level=2, importance=5, illegal=false, dangerous=false, }
goods["Egg"] = {name="Egg", plural="Eggs", description="Which came first, the chicken or the egg?", icon="data/textures/pizzaplus/icons/big-egg.png", price=70, size=2, level=0, importance=2, illegal=false, dangerous=false, }
goods["Garlic"] = {name="Garlic", plural="Garlic", description="A fragrant bulb that makes food worth eating.", icon="data/textures/pizzaplus/icons/garlic.png", price=291, size=0.3, level=5, importance=1, illegal=false, dangerous=false, }
goods["Gluten Free Vegan Pizza"] = {name="Gluten Free Vegan Pizza", plural="Gluten Free Vegan Pizza", description="If you think this is actually food...", icon="data/textures/pizzaplus/icons/turd.png", price=26, size=0.5, level=2, importance=0, illegal=false, dangerous=true, }
goods["Ham"] = {name="Ham", plural="Ham", description="The third most magical product derived from pigs.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=20, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Marinara Sauce"] = {name="Marinara Sauce", plural="Marinara Sauce", description="Tangy, herbed tomato sauce. Truly ambrosiacal application of tomatos.", icon="data/textures/icons/oil-drum.png", price=42, size=1, level=1, importance=2, illegal=false, dangerous=false, }
goods["Mushroom"] = {name="Mushroom", plural="Mushrooms", description="A mushroom is the fleshy, spore-bearing fruiting body of a fungus.", icon="data/textures/icons/mushroom.png", price=45, size=1, level=3, importance=2, illegal=false, dangerous=false, }
goods["Pepperoni"] = {name="Pepperoni", plural="Pepperoni", description="Spiced, fermented sausage, the only *real* pizza topping.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=309, size=0.3, level=5, importance=1, illegal=false, dangerous=false, }
goods["Pineapple"] = {name="Pineapple", plural="Pineapples", description="The pineapple is a tropical plant with an edible multiple fruit consisting of coalesced berries.", icon="data/textures/pizzaplus/icons/pineapple.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
goods["Olives"] = {name="Olive", plural="Olives", description="A cured and fremented drupe from the olive tree.", icon="data/textures/pizzaplus/icons/olive.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
goods["Pig"] = {name="Pig", plural="Pigs", description="The omnivorous source of that most magical of foods, bacon.", icon="data/textures/pizzaplus/icons/pig.png", price=132, size=1, level=2, importance=2, illegal=false, dangerous=false, }
goods["Pork"] = {name="Pork", plural="Pork", description="Proto-bacon and proto-ham.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=17, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Pizza Box"] = {name="Pizza Box", plural="Pizza Boxes", description="A high-tech, yet grease absorbing, self heating pizza box.", icon="data/textures/icons/cannister.png", price=308, size=0.75, level=5, importance=4, illegal=false, dangerous=false, }
goods["Pizza"] = {name="Pizza", plural="Pizzas", description="A high tech, self-heating box pre-loaded with a delicious pizza.", icon="data/textures/pizzaplus/icons/pizza-slice.png", price=10741, size=2.5, level=6, importance=0, illegal=false, dangerous=false, }
goods["Soylent Green"] = {name="Soylent Green", plural="Soylent Green", description="Soylent Green is People!", icon="data/textures/icons/beams-aura.png", price=223, size=0.5, level=2, importance=0, illegal=false, dangerous=false, }
goods["Tomato"] = {name="Tomato", plural="Tomatos", description="A large, juicy tomato.", icon="data/textures/pizzaplus/icons/apple-seeds.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
--End of pizzaplus

Link to comment
Share on other sites

Ok, now we are wandering into demon possession territory.  It is still giving me this error.

 

2017-11-28 13-24-54| error: Pizza Box is neither bought nor sold
2017-11-28 13-24-54| could not execute function 'Factory.updateServer' in '"data/scripts/entity/merchants/factory.lua"':
2017-11-28 13-24-54| data/scripts/lib/tradingmanager.lua:1123: attempt to perform arithmetic on local 'goodSize' (a nil value)
2017-11-28 13-24-54| stack traceback:
2017-11-28 13-24-54| 	data/scripts/lib/tradingmanager.lua:1123: in function <data/scripts/lib/tradingmanager.lua:1114>
2017-11-28 13-24-54| 	(...tail calls...)
2017-11-28 13-24-54| 	data/scripts/entity/merchants/factory.lua:497: in function <data/scripts/entity/merchants/factory.lua:457>

 

I can't figure out why.

 

With the errors already pointed out the box factory and the pizza factory are both working.  (it seems anyway)  I spawned one of each in and they have stuff to sell and list things they will buy.  I conjured both pizza and boxes from the debug menu and sold the pizza to a casino and the boxes to a pizza factory.

 

I went back and copy/pasted "Aluminium" (and all the other ingredients too) from goodsindex to the box factory.  I did the same with "Pizza Box" for all instances of it in productions index, kinda hoping I'd missed a typo, but now they will all be identical.

 

Seeing the error saying goodsize was nil, I double checked and the pizza box has all the size, importance, etc.  Could the level/importance be messing things up?  I just copied it from something else in the goodsindex.  Not knowing what those were for exactly, I just tried to find a product that was similar-ish to the new ones I was adding and copied the information from that.

 

productionsindex.lua

--pizzaplus start
table.insert(productions, {factory="${good} Manufacturing Plant ${size}", ingredients={{name="Slave", amount=1, optional=0}, {name="Solvent", amount=1, optional=0}}, results={{name="Soylent Green", amount=100}}, garbages={}})
table.insert(productions, {factory="The Matrix ${size}", ingredients={{name="Slave", amount=1, optional=0}, {name="Wire", amount=1, optional=0}, {name="Morn Drug", amount=1, optional=0}}, results={{name="Energy Cell", amount=500}, {name="Meat", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Dough", amount=1, optional=0}, {name="Marinara Sauce", amount=20, optional=0}, {name="Cheese", amount=10, optional=0}, {name="Pizza Box", amount=10, optional=0}, {name="Pepperoni", amount=1, optional=1}, {name="Anchovy", amount=2, optional=1}, {name="Pineapple", amount=5, optional=1}, {name="Olives", amount=5, optional=1}, {name="Mushroom", amount=10, optional=1}, {name="Ham", amount=10, optional=1}, {name="Bacon", amount=5, optional=1}}, results={{name="Pizza", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Cardboard", amount=1, optional=0}, {name="Energy Cell", amount=1, optional=0}, {name="Aluminium", amount=1, optional=0}, {name="Wire", amount=1, optional=0}}, results={{name="Pizza Box", amount=2}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Dairy", amount=5, optional=0}, {name="Chemicals", amount=1, optional=0}}, results={{name="Cheese", amount=3}}, garbages={{name="Water", amount=1}}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Wheat", amount=3, optional=0}, {name="Egg", amount=2, optional=0}, {name="Water", amount=1, optional=0}, {name="Fungus", amount=1, optional=0}}, results={{name="Dough", amount=5}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Tomato", amount=10, optional=0}, {name="Garlic", amount=2, optional=0}, {name="Spices", amount=1, optional=0}, {name="Mushrooms", amount=2, optional=0}}, results={{name="Marinara Sauce", amount=40}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=10, optional=0}, {name="Spices", amount=1, optional=0}, {name="Fungus", amount=1, optional=0}}, results={{name="Pepperoni", amount=3}}, garbages={}})
table.insert(productions, {factory="${good} Pickling Plant ${size}", ingredients={{name="Fish", amount=10, optional=0}, {name="Chemicals", amount=1, optional=0}, {name="Garlic", amount=3, optional=0}, {name="Cooking Oil", amount=1, optional=0}, {name="Spices", amount=1, optional=0}}, results={{name="Anchovy", amount=30}}, garbages={}})
table.insert(productions, {factory="${good} Extractor ${size}", ingredients={{name="Olives", amount=10, optional=0}, {name="Energy Cell", amount=1, optional=0}}, results={{name="Cooking Oil", amount=3}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Paper", amount=1, optional=0}, {name="Adhesive", amount=1, optional=0}, {name="Wood", amount=1, optional=0}}, results={{name="Cardboard", amount=5}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=1, optional=0}, {name="Corn", amount=3, optional=0}}, results={{name="Egg", amount=5}, {name="Chicken", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=40, optional=0}, {name="Fertilizer", amount=1, optional=0}}, results={{name="Pineapple", amount=20}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=30, optional=0}, {name="Fertilizer", amount=5, optional=0}}, results={{name="Tomato", amount=40}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=40, optional=0}, {name="Fertilizer", amount=5, optional=0}}, results={{name="Mushroom", amount=60}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=6, optional=1}, {name="Water", amount=30, optional=0}, {name="Fertilizer", amount=7, optional=0}}, results={{name="Olives", amount=45}}, garbages={{name="Oxygen", amount=8}}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=1, optional=0}, {name="Water", amount=1, optional=0}}, results={{name="Garlic", amount=4}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Water", amount=1, optional=0}, {name="Corn", amount=1, optional=1}, {name="Vegetable", amount=1, optional=1}, {name="Rice", amount=1, optional=1}}, results={{name="Pig", amount=1}}, garbages={{name="Fertilizer", amount=1}}})
table.insert(productions, {factory="${good} Processing Plant ${size}", ingredients={{name="Pig", amount=1, optional=0}, {name="Energy Cell", amount=1, optional=0}}, results={{name="Pork", amount=17}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=15, optional=0}, {name="Spices", amount=1, optional=0}, {name="Wood", amount=1, optional=0}, {name="Chemicals", amount=1, optional=0}}, results={{name="Bacon", amount=35}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=2, optional=0}, {name="Water", amount=1, optional=0}, {name="Spices", amount=1, optional=0}}, results={{name="Ham", amount=26}}, garbages={}})

 

goodsindex.lua

--Start of pizzaplus
goods["Anchovy"] = {name="Anchovy", plural="Anchovies", description="Fermented, pickled bait fish, suitable only as a cruel joke topping.", icon="data/textures/pizzaplus/icons/fried-fish.png", price=123, size=0.5, level=2, importance=0, illegal=false, dangerous=false, }
goods["Bacon"] = {name="Bacon", plural="Bacon", description="Alchemy in food form, the most magical product derived from pigs.", icon="data/textures/pizzaplus/icons/planks.png", price=46, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Cardboard"] = {name="Cardboard", plural="Cardboard", description="Strengthened paper product used in packaging.", icon="data/textures/pizzaplus/icons/folded-paper.png", price=56, size=1, level=2, importance=1, illegal=false, dangerous=false, }
goods["Cheese"] = {name="Cheese", plural="Cheese", description="Wheels of delicious cheese.", icon="data/textures/pizzaplus/icons/cheese-wedge.png", price=217, size=0.5, level=4, importance=1, illegal=false, dangerous=false, }
goods["Chicken"] = {name="Chicken", plural="Chickens", description="The pet that poops breakfast.", icon="data/textures/pizzaplus/icons/chicken.png", price=26, size=0.5, level=2, importance=2, illegal=false, dangerous=false, }
goods["Cooking Oil"] = {name="Cooking Oil", plural="Cooking Oil", description="A barrel of vegetable oil used for cooking food.", icon="data/textures/pizzaplus/icons/oil-drum.png", price=490, size=1, level=1, importance=4, illegal=false, dangerous=false, }
goods["Dough"] = {name="Dough", plural="Dough", description="A magical combinaion of protein rich flour, eggs, salt, and water.", icon="data/textures/pizzaplus/icons/dough-roller.png", price=79, size=0.5, level=2, importance=5, illegal=false, dangerous=false, }
goods["Egg"] = {name="Egg", plural="Eggs", description="Which came first, the chicken or the egg?", icon="data/textures/pizzaplus/icons/big-egg.png", price=70, size=2, level=0, importance=2, illegal=false, dangerous=false, }
goods["Garlic"] = {name="Garlic", plural="Garlic", description="A fragrant bulb that makes food worth eating.", icon="data/textures/pizzaplus/icons/garlic.png", price=291, size=0.3, level=5, importance=1, illegal=false, dangerous=false, }
goods["Gluten Free Vegan Pizza"] = {name="Gluten Free Vegan Pizza", plural="Gluten Free Vegan Pizza", description="If you think this is actually food...", icon="data/textures/pizzaplus/icons/turd.png", price=26, size=0.5, level=2, importance=0, illegal=false, dangerous=true, }
goods["Ham"] = {name="Ham", plural="Ham", description="The third most magical product derived from pigs.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=20, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Marinara Sauce"] = {name="Marinara Sauce", plural="Marinara Sauce", description="Tangy, herbed tomato sauce. Truly ambrosiacal application of tomatos.", icon="data/textures/icons/oil-drum.png", price=42, size=1, level=1, importance=2, illegal=false, dangerous=false, }
goods["Mushroom"] = {name="Mushroom", plural="Mushrooms", description="A mushroom is the fleshy, spore-bearing fruiting body of a fungus.", icon="data/textures/icons/mushroom.png", price=45, size=1, level=3, importance=2, illegal=false, dangerous=false, }
goods["Pepperoni"] = {name="Pepperoni", plural="Pepperoni", description="Spiced, fermented sausage, the only *real* pizza topping.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=309, size=0.3, level=5, importance=1, illegal=false, dangerous=false, }
goods["Pineapple"] = {name="Pineapple", plural="Pineapples", description="The pineapple is a tropical plant with an edible multiple fruit consisting of coalesced berries.", icon="data/textures/pizzaplus/icons/pineapple.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
goods["Olives"] = {name="Olive", plural="Olives", description="A cured and fremented drupe from the olive tree.", icon="data/textures/pizzaplus/icons/olive.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
goods["Pig"] = {name="Pig", plural="Pigs", description="The omnivorous source of that most magical of foods, bacon.", icon="data/textures/pizzaplus/icons/pig.png", price=132, size=1, level=2, importance=2, illegal=false, dangerous=false, }
goods["Pork"] = {name="Pork", plural="Pork", description="Proto-bacon and proto-ham.", icon="data/textures/pizzaplus/icons/ham-shank.png", price=17, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Pizza Box"] = {name="Pizza Box", plural="Pizza Boxes", description="A high-tech, yet grease absorbing, self heating pizza box.", icon="data/textures/icons/cannister.png", price=308, size=0.75, level=5, importance=4, illegal=false, dangerous=false, }
goods["Pizza"] = {name="Pizza", plural="Pizzas", description="A high tech, self-heating box pre-loaded with a delicious pizza.", icon="data/textures/pizzaplus/icons/pizza-slice.png", price=10741, size=2.5, level=6, importance=0, illegal=false, dangerous=false, }
goods["Soylent Green"] = {name="Soylent Green", plural="Soylent Green", description="Soylent Green is People!", icon="data/textures/icons/beams-aura.png", price=223, size=0.5, level=2, importance=0, illegal=false, dangerous=false, }
goods["Tomato"] = {name="Tomato", plural="Tomatos", description="A large, juicy tomato.", icon="data/textures/pizzaplus/icons/apple-seeds.png", price=84, size=0.5, level=1, importance=2, illegal=false, dangerous=false, }
--End of pizzaplus

Link to comment
Share on other sites

Has all your testing been in the same galaxy? If so, may I suggest that you try creating a new galaxy and test if spawning the factories in there no longer produces that error?

 

This is based on my somewhat limited understanding of the factories work. Normally I would post a 'brief' explanation of my reasoning along with my suggestion but I do not the time to write it up currently, although if testing in a brand new galaxy does not generate the error then I can post an explanation later on if you wish.

Link to comment
Share on other sites

I have been testing in a singleplayer created just for testing.  It might be worth trying a fresh galaxy.

 

I shall report back.

 

Edit: That seemed to do the trick. 

 

I wonder what that implies for the process of adding goods to an already established galaxy.  Maybe it generated a factory needing a flawed version that had since been removed by fixing the error.  No matter what I did to fix the error, that borked factory always wanted the flawed version.

 

I know that even if you make changes to a factory in the file, anything already spawned in uses whatever stats/materials that were specified when it was spawned.  You can't change the production stats and have it apply to already spawned stations, you have to spawn a new one to see the changes.

 

Lesson learned, test well, then roll it out.

 

I cannot thank you all enough.  I did all I could and was blinded by that and needed a fresh set of eyes to see what I'd missed.  You all deserve cookies.

Link to comment
Share on other sites

Glad to hear that the error is gone.

 

I wonder what that implies for the process of adding goods to an already established galaxy.  Maybe it generated a factory needing a flawed version that had since been removed by fixing the error.  No matter what I did to fix the error, that borked factory always wanted the flawed version.

 

I know that even if you make changes to a factory in the file, anything already spawned in uses whatever stats/materials that were specified when it was spawned.  You can't change the production stats and have it apply to already spawned stations, you have to spawn a new one to see the changes.

 

Adding new goods/productions to an existing galaxy will work fine as long as you add them to the end of the index files. Factories store all their production data in the save file so removing or in this case renaming a good/production will cause errors. I would guess that in the process of changing 'Self-Heating Pizza Box' to 'Pizza Box' one of the factories was set to make pizza boxes but it failed to properly setup its list of sold goods, so afterwards whenever it checked whether it had enough space in storage to make another pizza box it would produce that error.

 

The reason I specifically stated to add the new goods/productions to the end of the lua file is because factories save the 'index' of the production, which is its position in productionsindex.lua. I have not tested this out in-game but that would suggest that adding productions to the beginning of that file or even reordering the list of productions could cause problems in pre-existing galaxies.

 

Oh, and to answer an earlier question. A good's level/importance affects how likely it will be chosen as the produced good when spawning a random factory, higher level goods are rarer while more important goods are more common. Also some sectors only spawn factories that produces goods of a certain range of levels, so adding tons of low level goods will not have too great of an effect on the number of factories that spawn producing high level goods.

 

You all deserve cookies.

 

Alas, there are no cookies in Avorion... perhaps that can be fixed...

Link to comment
Share on other sites

The reason I specifically stated to add the new goods/productions to the end of the lua file is because factories save the 'index' of the production, which is its position in productionsindex.lua. I have not tested this out in-game but that would suggest that adding productions to the beginning of that file or even reordering the list of productions could cause problems in pre-existing galaxies.

 

You all deserve cookies.

 

Alas, there are no cookies in Avorion... perhaps that can be fixed...

 

I think I will re-do my mod then.  If adding at the beginning is bad then that is the source of my problems.  I kinda just took my cue from Lazerzwei's all production chains and put them at the top.  It made it easier to work on the files as well.

 

Do you think goodsindex and productionsindex will both need this?  I have been adding factories at the top of productionsindex just for ease of finding them and keeping them all in one place, and it seems not to have caused problems up until now.  However, the factories I was adding were all working on goods already in place and the pizza stuff was adding goods left and right.  I guess with comments it shouldn't be a huge thing to relocate stuff to the bottom of the file from now on.  The re-ordering might also explain some errors that happened with established factories when I loaded it on the server.  Note to self: change this now.

 

As for cookies, I do believe I can add those to Avorion ;-)

Link to comment
Share on other sites

It does not matter where you add new productions to productionsindex.lua, at the top or bottom or middle or wherever. Never modded new goods, but i think it should be the same there.

What you may do in an existing galaxy:

  • Add/change/delete entries in productionindex.lua (existing stations are not affected by changes in this file)
  • Add new goods to goodsindex.lua
  • Change stats of existing goods like price or size (but not the name)

What you must NOT do in an existing galaxy:

  • Change good names
  • Delete goods

The reason is, that productionsindex.lua is only used when stations are created/generated. The productions and consumtions will be saved at the entity and the values of productionsindex.lua does not do anything to this station anymore.

But goodsindex.lua is always used to load goods. As soon as you implement "Aluminum" (the wrong spelled one) to the galaxy, you must have this good in your goodsindex.lua, or you get errors. If you change the size of any good, all existing goods of this type will use the new value cause its always loaded from goodsindex.lua.

 

Link to comment
Share on other sites

From my observations, it might matter where in goodsindex you put the new stuff.

 

When I first tried to implement this for testing on the server (kinda stupid in retrospect, though I wouldn't have caught this w/o it), suddenly all the factories and mines I'd made were making something different.  When I un-built and re-built them they seemed to work, but when I put in some more stuff, boom, all the factories were messed up again.

 

Going forward, I'm going to keep my new factories at the top of the file to make them easier to see and work with, but I'm going to add new goods to the bottom of the file so they don't mess up ordering.  I will have to do some testing where I make some factories and then add some new goods and see if it messes things up.

Link to comment
Share on other sites

I'm stumped again.  I added the last 7 factories I needed and the final good today.  Everything is running without errors, but I can't spawn the last 7 factories either through the debug menu or by founding a station with a ship.

 

The last good in the goodsindex also doesn't show up in the spawn cargo tab on the debug menu either.

 

I've installed it locally, I've installed it on the server.  I've double checked to see that the stuff *is* in the files in the game folders.  Restarted my game totally, even snuck in a reboot on the computer.  I even started a new single player world and still can't found them or spawn one in.  Everything from the BBQ Sauce Bottling Factory on down is MIA, and so is Stuffing.

 

Any ideas?  See what I've missed?

 

productionsindex.lua

table.insert(productions, {factory="${good} Bottling Factory ${size}", ingredients={{name="Tomato", amount=50, optional=0}, {name="Fruit", amount=50, optional=0}, {name="Anchovy", amount=50, optional=0}, {name="Spices", amount=10, optional=0}}, results={{name="Brown Sauce", amount=100}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Rice", amount=100, optional=0}, {name="Spices", amount=5, optional=0}, {name="Vegetable", amount=40, optional=0}, {name="Chicken", amount=20, optional=0}, {name="Egg", amount=10, optional=0}}, results={{name="Fried Rice", amount=25}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Wheat", amount=1, optional=0}, {name="Egg", amount=1, optional=0}, {name="Water", amount=1, optional=0}}, results={{name="Noodle", amount=1}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Pork", amount=5, optional=0}, {name="Wood", amount=1, optional=0}, {name="Spices", amount=1, optional=0}}, results={{name="Pulled Pork", amount=7}}, garbages={}})
table.insert(productions, {factory="${good} Bottling Factory ${size}", ingredients={{name="Tomato", amount=20, optional=0}, {name="Wood", amount=10, optional=0}, {name="Spices", amount=5, optional=0}, {name="Sugar", amount=10, optional=1}, {name="Acid", amount=3, optional=1}}, results={{name="BBQ Sauce", amount=50}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Bacon", amount=4, optional=0}, {name="Bread", amount=2, optional=0}, {name="Dairy", amount=1, optional=0}, {name="Brown Sauce", amount=1, optional=0}, {name="Ketchup", amount=1, optional=1}}, results={{name="Bacon Sandwich", amount=5}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Sheep", amount=4, optional=0}, {name="Onion", amount=15, optional=0}, {name="Oat", amount=20, optional=0}, {name="Spices", amount=2, optional=0}, {name="Cattle", amount=1, optional=1}}, results={{name="Haggis", amount=13}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Noodle", amount=5, optional=0}, {name="Cheese", amount=2, optional=0}, {name="Dairy", amount=5, optional=0}, {name="Water", amount=10, optional=0}}, results={{name="Mac n Cheese", amount=7}}, garbages={}})
table.insert(productions, {factory="${good} Farm ${size}", ingredients={{name="Energy Cell", amount=5, optional=0}, {name="Water", amount=10, optional=0}, {name="Fertilizer", amount=5, optional=0}}, results={{name="Onion", amount=75}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Vegetable", amount=5, optional=0}, {name="Potato", amount=5, optional=0}, {name="Dairy", amount=2, optional=0}}, results={{name="Neeps n Tatties", amount=6}}, garbages={}})
table.insert(productions, {factory="${good} Bakery ${size}", ingredients={{name="Wheat", amount=20, optional=0}, {name="Egg", amount=5, optional=0}, {name="Dairy", amount=15, optional=0}, {name="Sugar", amount=10, optional=0}}, results={{name="Cake", amount=15}}, garbages={}})
table.insert(productions, {factory="${good} Factory ${size}", ingredients={{name="Bread", amount=10, optional=0}, {name="Meat", amount=10, optional=0}, {name="Lettuce", amount=10, optional=0}, {name="Cheese", amount=10, optional=0}, {name="Ketchup", amount=5, optional=1}, {name="Mustard", amount=5, optional=1}, {name="BBQ Sauce", amount=5, optional=1}}, results={{name="Hamburger", amount=1}}, garbages={}})

 

goodsindex.lua

goods["Sushi"] = {name="Sushi", plural="Sushi", description="Select cuts of raw fish on rice wrapped in seaweed.", icon="mods/pizzaplus/data/textures/icons/fishing.png", price=150, size=0.1, level=4, importance=0, illegal=false, dangerous=false, }
goods["Pulled Pork"] = {name="Pulled Pork", plural="Pulled Pork", description="The second most magical product derived from pigs.", icon="mods/pizzaplus/data/textures/icons/magick-trick.png", price=169, size=0.5, level=3, importance=2, illegal=false, dangerous=false, }
goods["Hamburger"] = {name="Hamburger", plural="Hamburgers", description="A ground meat sandwich.", icon="mods/pizzaplus/data/textures/icons/hamburger.png", price=7741, size=1, level=6, importance=0, illegal=false, dangerous=false, }
goods["Fish and Chips"] = {name="Fish and Chips", plural="Fish and Chips", description="Breaded, deep fried fish with deep fried potatos.", icon="mods/pizzaplus/data/textures/icons/fish-smoking.png", price=300, size=0.5, level=4, importance=0, illegal=false, dangerous=false, }
goods["Bacon Sandwich"] = {name="Bacon Sandwich", plural="Bacon Sandwiches", description="A sandwich of cooked back bacon between bread that is usually spread with butter, and may be seasoned with ketchup or brown sauce.", icon="mods/pizzaplus/data/textures/icons/sliced-bread.png", price=150, size=0.1, level=4, importance=0, illegal=false, dangerous=false, }
goods["Stuffing"] = {name="Stuffing", plural="Stuffing", description="Bread based dressing originally cooked in the cavity of a turkey.", icon="mods/pizzaplus/data/textures/icons/fleshy-mass.png", price=65, size=0.1, level=4, importance=0, illegal=false, dangerous=false, }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...