Page 1 of 1

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

Posted: Fri Aug 14, 2020 1:37 pm
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

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

Posted: Fri Aug 14, 2020 1:51 pm
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.