Page 1 of 1
EnergySource's type property is not marked optional
Posted: Fri Oct 06, 2023 7:16 am
by BrainGamer_
The
type property of a
EnergySource like
BurnerEnergySource is not marked as an optional and has no further information provided than a static value.
Apparently this is not 100% correct since the
type field can be missing if the property that energy source is on allows only a single type of energy source.
Re: EnergySource's type property is not marked optional
Posted: Fri Oct 06, 2023 12:12 pm
by curiosity
IMO, it shouldn't allow omission even if unambiguous in certain cases.
Re: EnergySource's type property is not marked optional
Posted: Fri Oct 06, 2023 12:18 pm
by BrainGamer_
That is the behavior the current documentation implies at least yeah.
Tho I got my prototype parser to work around it and rather even better since it forced me to handle it in a way that made me better represent the difference between "any" energy source and a specific one being required for a property.
Re: EnergySource's type property is not marked optional
Posted: Fri Oct 06, 2023 12:27 pm
by curiosity
curiosity wrote: Fri Oct 06, 2023 12:12 pm
IMO, it shouldn't allow omission even if unambiguous in certain cases.
To elaborate, there are two reasons for this:
1. It disrupts the locality of the definition. You have to look at the outer context to see what the default value is.
2. It makes the codebase harder to extend. Imagine some property supports only one type of energy source and type is optional. Mods omit type. Then Wube considers extending that property to support more energy source types. They will either have to break backwards compatibility by making type mandatory or add workarounds to deal with the missing type. This makes the possibility of the support being extended virtually impossible, leading to modders stuck forever with compound entity runtime hacks.
Re: EnergySource's type property is not marked optional
Posted: Sat Oct 14, 2023 7:25 pm
by braxbro
curiosity wrote: Fri Oct 06, 2023 12:27 pm
To elaborate, there are two reasons for this:
1. It disrupts the locality of the definition. You have to look at the outer context to see what the default value is.
2. It makes the codebase harder to extend. Imagine some property supports only one type of energy source and type is optional. Mods omit type. Then Wube considers extending that property to support more energy source types. They will either have to break backwards compatibility by making type mandatory or add workarounds to deal with the missing type. This makes the possibility of the support being extended virtually impossible, leading to modders stuck forever with compound entity runtime hacks.
Alternatively, just make the default depend on the entity it's used in and make the type property properly optional in all cases.
Re: EnergySource's type property is not marked optional
Posted: Sun Oct 15, 2023 7:51 am
by curiosity
braxbro wrote: Sat Oct 14, 2023 7:25 pm
Alternatively, just make the default depend on the entity it's used in and make the type property properly optional in all cases.
See point one.
Re: EnergySource's type property is not marked optional
Posted: Sun Oct 15, 2023 2:58 pm
by braxbro
curiosity wrote: Sun Oct 15, 2023 7:51 am
See point one.
I don’t think that defaults need to be entirely localized to the structure. Especially if they’re intuitive for those who have worked with the game for awhile (assemblers defaulting to electric, furnaces defaulting to burner, etc.)
Re: EnergySource's type property is not marked optional
Posted: Mon Oct 16, 2023 9:46 am
by curiosity
braxbro wrote: Sun Oct 15, 2023 2:58 pm
I don’t think that defaults need to be entirely localized to the structure. Especially if they’re intuitive for those who have worked with the game for awhile (assemblers defaulting to electric, furnaces defaulting to burner, etc.)
So you advocate for raising the entry level to modding? Not that I'm against, but I get the impression that it's not a popular idea.
Re: EnergySource's type property is not marked optional
Posted: Mon Oct 16, 2023 9:55 pm
by braxbro
curiosity wrote: Mon Oct 16, 2023 9:46 am
So you advocate for raising the entry level to modding? Not that I'm against, but I get the impression that it's not a popular idea.
I think that allowing modders to make shortcuts that are intuitive for those familiar with the game is good.
Re: EnergySource's type property is not marked optional
Posted: Wed Oct 18, 2023 1:26 am
by FuryoftheStars
braxbro wrote: Mon Oct 16, 2023 9:55 pm
curiosity wrote: Mon Oct 16, 2023 9:46 am
So you advocate for raising the entry level to modding? Not that I'm against, but I get the impression that it's not a popular idea.
I think that allowing modders to make shortcuts that are intuitive for those familiar with the game is good.
Hmm, I feel as though I'm of the opposite opinion on this. If there's a default depending on the entity, then this means that I now also have to lookup what that is for the entity each time, so not a shortcut.
Re: EnergySource's type property is not marked optional
Posted: Mon Nov 06, 2023 11:29 am
by Bilka
I added a note to the docs for the next version and marked the property optional. Only burner and electric energy source have spots where they are the only allowed energy source, so I did not add the note to fluid/void/heat.