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.
EntityWithHealthPrototype resistances field is a singular rather than array?
- Muppet9010
- Filter Inserter
- Posts: 279
- Joined: Sat Dec 09, 2017 6:01 pm
- Contact:
EntityWithHealthPrototype resistances field is a singular rather than array?
Last edited by Muppet9010 on Thu Oct 26, 2023 9:02 am, edited 1 time in total.
-
- Fast Inserter
- Posts: 220
- Joined: Sat Oct 07, 2023 6:44 am
- Contact:
Re: EntityWithHealthPrototype resistances field is a singular rather than array?
From the completely working Space Exploration mod, resistances of the thruster suit are defined like this:
I don't see any issue with the docs?
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"
}
}
- Muppet9010
- Filter Inserter
- Posts: 279
- Joined: Sat Dec 09, 2017 6:01 pm
- Contact:
Re: EntityWithHealthPrototype resistances field is a singular rather than array?
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?
Funny that even the examples from the docs themselves declare an array.
Re: EntityWithHealthPrototype resistances field is a singular rather than array?
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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.