[1.0.0] Spidertron recipe has 'normal' property but not 'expensive'

Place to get help with not working mods / modding interface.
DeadlySurprise
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Aug 14, 2020 1:17 pm
Contact:

[1.0.0] Spidertron recipe has 'normal' property but not 'expensive'

Post by DeadlySurprise »

According to the Factorio wiki a recipe prototype should either specify ingredients directly in the recipe or provide it in both normal and expensive difficulty. Both the SeaBlock and CircuitProcessing Mod only check for the 'normal' property and therefore crash when trying to access the spidertron's missing 'expensive' prop.

Example code that crashes because of this:

Code: Select all

if recipe.normal then
    func(recipe.normal)
else
    func(recipe)
end
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [1.0.0] Spidertron recipe has 'normal' property but not 'expensive'

Post by Bilka »

The code that the mods use is wrong. Quoting the wiki, "Not setting a difficulty, e.g. normal = nil, is possible and gives that difficulty the exact same properties as the difficulty that is defined. ". This is exactly what is being done with spidertron and the expensive difficulty. You may want to test the mod code with https://mods.factorio.com/mod/Perfectly ... Prototypes, the mod deliberately creates edge-case prototypes so you can make sure they are handled.

Moving to modding help.

PS: The recipe definition syntax will be simplified to the expected format in the next release (no normal and no expensive), but mods should still handle this edge-case.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Modding help”