Changeset View
Standalone View
binaries/data/mods/public/gui/gamesettings/attributes/MapExploration.js
GameSettings.prototype.Attributes.MapExploration = class MapExploration extends GameSetting | GameSettings.prototype.Attributes.MapExploration = class MapExploration extends GameSetting | ||||
{ | { | ||||
init() | init() | ||||
{ | { | ||||
this.explored = false; | this.explored = false; | ||||
this.revealed = false; | this.revealed = false; | ||||
this.allied = false; | |||||
this.settings.map.watch(() => this.onMapChange(), ["map"]); | this.settings.map.watch(() => this.onMapChange(), ["map"]); | ||||
} | } | ||||
toInitAttributes(attribs) | toInitAttributes(attribs) | ||||
{ | { | ||||
attribs.settings.RevealMap = this.revealed; | attribs.settings.RevealMap = this.revealed; | ||||
attribs.settings.ExploreMap = this.explored; | attribs.settings.ExploreMap = this.explored; | ||||
attribs.settings.AllyView = this.allied; | |||||
} | } | ||||
fromInitAttributes(attribs) | fromInitAttributes(attribs) | ||||
{ | { | ||||
this.explored = !!this.getLegacySetting(attribs, "ExploreMap"); | this.explored = !!this.getLegacySetting(attribs, "ExploreMap"); | ||||
this.revealed = !!this.getLegacySetting(attribs, "RevealMap"); | this.revealed = !!this.getLegacySetting(attribs, "RevealMap"); | ||||
this.allied = !!this.getLegacySetting(attribs, "AllyView"); | |||||
} | } | ||||
onMapChange(mapData) | onMapChange(mapData) | ||||
{ | { | ||||
if (this.settings.map.type != "scenario") | if (this.settings.map.type != "scenario") | ||||
return; | return; | ||||
this.setExplored(this.getMapSetting("ExploreMap")); | this.setExplored(this.getMapSetting("ExploreMap")); | ||||
this.setRevealed(this.getMapSetting("RevealMap")); | this.setRevealed(this.getMapSetting("RevealMap")); | ||||
this.setAllied(this.getMapSetting("AllyView")); | |||||
Silier: Wrong function | |||||
} | } | ||||
setExplored(enabled) | setExplored(enabled) | ||||
{ | { | ||||
this.explored = enabled; | this.explored = enabled; | ||||
this.revealed = this.revealed && this.explored; | this.revealed = this.revealed && this.explored; | ||||
} | } | ||||
setRevealed(enabled) | setRevealed(enabled) | ||||
{ | { | ||||
this.explored = this.explored || enabled; | this.explored = this.explored || enabled; | ||||
this.revealed = enabled; | this.revealed = enabled; | ||||
this.allied = this.allied || enabled; | |||||
Done Inline Actionswhy do allied and revealed depend one on the other? Silier: why do allied and revealed depend one on the other? | |||||
Done Inline ActionsIf the map is revealed there is no point in alliedView, so it is better to just disable the tech. Freagarach: If the map is revealed there is no point in alliedView, so it is better to just disable the… | |||||
Done Inline Actionsthats not what this line does Silier: thats not what this line does | |||||
Done Inline ActionsThis line sets alliedView to true when revealed is true. You _can_ see what your ally sees when the whole map is revealed? Freagarach: This line sets alliedView to true when revealed is true. You _can_ see what your ally sees when… | |||||
Done Inline ActionsYou just contradicted what you said in comment before Silier: You just contradicted what you said in comment before | |||||
Done Inline ActionsYeah, I meant there is no point in disabling alliedView. Freagarach: Yeah, I meant there is no point in disabling alliedView. | |||||
} | |||||
setAllied(enabled) | |||||
{ | |||||
this.allied = enabled; | |||||
this.revealed = this.revealed && this.allied; | |||||
Done Inline ActionsShouldn't one use setRevealed here? Now when it changes it misses setting the explored? Freagarach: Shouldn't one use `setRevealed` here? Now when it changes it misses setting the explored? | |||||
Done Inline ActionsIf you have "revealed" map enabled, you can see the whole map and every player. Therefore "explored" and "allyView" are implicitly enabled.
I don't think it matters. The only purpose of this line is to disable "revealed", when "allied" is changed to disabled. "explored" setting shouldn't need checking; If you change "explored" to false, "revealed" will be disabled. Enabling "allied" will not re-enable "revealed" (nor explored). Jammyjamjamman: If you have "revealed" map enabled, you can see the whole map and every player. Therefore… | |||||
} | } | ||||
}; | }; |
Wrong function