Page 1 of 1
EntityWithHealthPrototype resistances field is a singular rather than array?
Posted: Wed Oct 25, 2023 9:52 pm
by Muppet9010
The definition of the resistances field in EntityWithHealthPrototype is the type of Resistances. But looking at this Resistances class its a single object/table, rather than supporting an array of Resistances.
I'm not entirely sure on what the valid options are the, but the example array of tables in the Docs are both flagged as invalid by Sumneko using the TyepDefs.
https://lua-api.factorio.com/latest/pro ... esistances
Note that the Wiki looks to have had the same issue.
Re: EntityWithHealthPrototype resistances field is a singular rather than array?
Posted: Thu Oct 26, 2023 2:52 am
by computeraddict
From the completely working Space Exploration mod, resistances of the thruster suit are defined like this:
Code: Select all
resistances = {
{
percent = 30,
type = "physical"
},
{
decrease = 0,
percent = 30,
type = "acid"
},
{
decrease = 0,
percent = 30,
type = "explosion"
},
{
decrease = 0,
percent = 60,
type = "fire"
}
}
I don't see any issue with the docs?
Re: EntityWithHealthPrototype resistances field is a singular rather than array?
Posted: Thu Oct 26, 2023 9:02 am
by Muppet9010
The docs list a single object/table of fields. But accepts an array of objects as per your included example.
Re: EntityWithHealthPrototype resistances field is a singular rather than array?
Posted: Thu Oct 26, 2023 10:03 am
by curiosity
Funny that even the examples from the docs themselves declare an array.
Re: EntityWithHealthPrototype resistances field is a singular rather than array?
Posted: Thu Oct 26, 2023 5:36 pm
by Bilka
It is indeed an array of the struct. Some array types are documented in a bit of a roundabout way, which can lead to actual array part being overlooked. ArmorPrototype::resistances was also affected. Both are fixed for the next version, thanks for the report.