Differential D2483 Diff 10823 binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Cheats.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Cheats.js
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
/** | |||||
* Cheats are always enabled in singleplayer mode, since they are the choice of that one player. | |||||
*/ | |||||
GameSettingControls.Cheats = class extends GameSettingControlCheckbox | |||||
{ | |||||
constructor(...args) | |||||
{ | |||||
super(...args); | |||||
this.setHidden(!g_IsNetworked); | |||||
} | |||||
onGameAttributesChange() | |||||
{ | |||||
if (g_GameAttributes.settings.CheatsEnabled === undefined || | |||||
g_GameAttributes.settings.CheatsEnabled && g_GameAttributes.settings.RatingEnabled || | |||||
!g_GameAttributes.settings.CheatsEnabled && !g_IsNetworked) | |||||
{ | |||||
g_GameAttributes.settings.CheatsEnabled = !g_IsNetworked; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
} | |||||
this.setChecked(g_GameAttributes.settings.CheatsEnabled); | |||||
this.setEnabled(!g_GameAttributes.settings.RatingEnabled); | |||||
} | |||||
onPress(checked) | |||||
{ | |||||
g_GameAttributes.settings.CheatsEnabled = | |||||
!g_IsNetworked || | |||||
checked && !g_GameAttributes.settings.RatingEnabled; | |||||
this.gameSettingsControl.updateGameAttributes(); | |||||
this.gameSettingsControl.setNetworkGameAttributes(); | |||||
} | |||||
}; | |||||
GameSettingControls.Cheats.prototype.TitleCaption = | |||||
translate("Cheats"); | |||||
GameSettingControls.Cheats.prototype.Tooltip = | |||||
translate("Toggle the usability of cheats."); |
Wildfire Games · Phabricator