forked from 0ad/0ad
Add option to disable treasures on skirmish and random maps
This was SVN commit r16469.
This commit is contained in:
parent
1cd41e33c6
commit
798cd2963e
@ -240,6 +240,10 @@ function initMain()
|
||||
updateGameAttributes();
|
||||
};
|
||||
|
||||
Engine.GetGUIObjectByName("disableTreasures").onPress = function() {
|
||||
g_GameAttributes.settings.DisableTreasures = this.checked;
|
||||
updateGameAttributes();
|
||||
};
|
||||
|
||||
Engine.GetGUIObjectByName("lockTeams").onPress = function() {
|
||||
g_GameAttributes.settings.LockTeams = this.checked;
|
||||
@ -1130,6 +1134,7 @@ function onGameAttributesChange()
|
||||
var numPlayersSelection = Engine.GetGUIObjectByName("numPlayersSelection");
|
||||
var revealMap = Engine.GetGUIObjectByName("revealMap");
|
||||
var exploreMap = Engine.GetGUIObjectByName("exploreMap");
|
||||
var disableTreasures = Engine.GetGUIObjectByName("disableTreasures");
|
||||
var victoryCondition = Engine.GetGUIObjectByName("victoryCondition");
|
||||
var lockTeams = Engine.GetGUIObjectByName("lockTeams");
|
||||
var mapSize = Engine.GetGUIObjectByName("mapSize");
|
||||
@ -1143,6 +1148,7 @@ function onGameAttributesChange()
|
||||
var mapSizeText = Engine.GetGUIObjectByName("mapSizeText");
|
||||
var revealMapText = Engine.GetGUIObjectByName("revealMapText");
|
||||
var exploreMapText = Engine.GetGUIObjectByName("exploreMapText");
|
||||
var disableTreasuresText = Engine.GetGUIObjectByName("disableTreasuresText");
|
||||
var victoryConditionText = Engine.GetGUIObjectByName("victoryConditionText");
|
||||
var lockTeamsText = Engine.GetGUIObjectByName("lockTeamsText");
|
||||
var enableCheatsText = Engine.GetGUIObjectByName("enableCheatsText");
|
||||
@ -1193,6 +1199,7 @@ function onGameAttributesChange()
|
||||
updateDisplay(mapSize, mapSizeText, g_IsController);
|
||||
updateDisplay(revealMap, revealMapText, g_IsController);
|
||||
updateDisplay(exploreMap, exploreMapText, g_IsController);
|
||||
updateDisplay(disableTreasures, disableTreasuresText, g_IsController);
|
||||
updateDisplay(victoryCondition, victoryConditionText, g_IsController);
|
||||
updateDisplay(lockTeams, lockTeamsText, g_IsController);
|
||||
updateDisplay(populationCap, populationCapText, g_IsController);
|
||||
@ -1205,6 +1212,7 @@ function onGameAttributesChange()
|
||||
mapSize.selected = sizeIdx;
|
||||
revealMap.checked = (mapSettings.RevealMap ? true : false);
|
||||
exploreMap.checked = (mapSettings.ExploreMap ? true : false);
|
||||
disableTreasures.checked = (mapSettings.DisableTreasures ? true : false);
|
||||
victoryCondition.selected = victoryIdx;
|
||||
lockTeams.checked = (mapSettings.LockTeams ? true : false);
|
||||
}
|
||||
@ -1215,6 +1223,7 @@ function onGameAttributesChange()
|
||||
mapSizeText.caption = g_MapSizes.names[sizeIdx];
|
||||
revealMapText.caption = (mapSettings.RevealMap ? translate("Yes") : translate("No"));
|
||||
exploreMapText.caption = (mapSettings.ExporeMap ? translate("Yes") : translate("No"));
|
||||
disableTreasuresText.caption = (mapSettings.DisableTreasures ? translate("Yes") : translate("No"));
|
||||
victoryConditionText.caption = victories.text[victoryIdx];
|
||||
lockTeamsText.caption = (mapSettings.LockTeams ? translate("Yes") : translate("No"));
|
||||
}
|
||||
@ -1232,6 +1241,7 @@ function onGameAttributesChange()
|
||||
|
||||
updateDisplay(revealMap, revealMapText, g_IsController);
|
||||
updateDisplay(exploreMap, exploreMapText, g_IsController);
|
||||
updateDisplay(disableTreasures, disableTreasuresText, g_IsController);
|
||||
updateDisplay(victoryCondition, victoryConditionText, g_IsController);
|
||||
updateDisplay(lockTeams, lockTeamsText, g_IsController);
|
||||
updateDisplay(populationCap, populationCapText, g_IsController);
|
||||
@ -1242,6 +1252,7 @@ function onGameAttributesChange()
|
||||
//Host
|
||||
revealMap.checked = (mapSettings.RevealMap ? true : false);
|
||||
exploreMap.checked = (mapSettings.ExploreMap ? true : false);
|
||||
disableTreasures.checked = (mapSettings.DisableTreasures ? true : false);
|
||||
victoryCondition.selected = victoryIdx;
|
||||
lockTeams.checked = (mapSettings.LockTeams ? true : false);
|
||||
}
|
||||
@ -1250,6 +1261,7 @@ function onGameAttributesChange()
|
||||
// Client
|
||||
revealMapText.caption = (mapSettings.RevealMap ? translate("Yes") : translate("No"));
|
||||
exploreMapText.caption = (mapSettings.ExploreMap ? translate("Yes") : translate("No"));
|
||||
disableTreasuresText.caption = (mapSettings.DisableTreasures ? translate("Yes") : translate("No"));
|
||||
victoryConditionText.caption = victories.text[victoryIdx];
|
||||
lockTeamsText.caption = (mapSettings.LockTeams ? translate("Yes") : translate("No"));
|
||||
}
|
||||
@ -1263,6 +1275,7 @@ function onGameAttributesChange()
|
||||
mapSize.hidden = true;
|
||||
revealMap.hidden = true;
|
||||
exploreMap.hidden = true;
|
||||
disableTreasures.hidden = true;
|
||||
victoryCondition.hidden = true;
|
||||
lockTeams.hidden = true;
|
||||
numPlayersText.hidden = false;
|
||||
@ -1270,6 +1283,7 @@ function onGameAttributesChange()
|
||||
mapSizeDesc.hidden = true;
|
||||
revealMapText.hidden = false;
|
||||
exploreMapText.hidden = false;
|
||||
disableTreasuresText.hidden = false;
|
||||
victoryConditionText.hidden = false;
|
||||
lockTeamsText.hidden = false;
|
||||
populationCap.hidden = true;
|
||||
@ -1281,6 +1295,7 @@ function onGameAttributesChange()
|
||||
mapSizeText.caption = translate("Default");
|
||||
revealMapText.caption = (mapSettings.RevealMap ? translate("Yes") : translate("No"));
|
||||
exploreMapText.caption = (mapSettings.ExploreMap ? translate("Yes") : translate("No"));
|
||||
disableTreasuresText.caption = translate("No");
|
||||
victoryConditionText.caption = victories.text[victoryIdx];
|
||||
lockTeamsText.caption = (mapSettings.LockTeams ? translate("Yes") : translate("No"));
|
||||
Engine.GetGUIObjectByName("populationCap").selected = POPULATION_CAP_DEFAULTIDX;
|
||||
|
@ -270,7 +270,7 @@
|
||||
|
||||
<!-- More Options -->
|
||||
<object hidden="true" name="moreOptionsFade" type="image" z="60" sprite="ModernFade"/>
|
||||
<object name="moreOptions" type="image" sprite="ModernDialog" size="50%-200 50%-175 50%+200 50%+180" z="70" hidden="true">
|
||||
<object name="moreOptions" type="image" sprite="ModernDialog" size="50%-200 50%-195 50%+200 50%+190" z="70" hidden="true">
|
||||
<object style="ModernLabelText" type="text" size="50%-128 -18 50%+128 14">
|
||||
<translatableAttribute id="caption">More Options</translatableAttribute>
|
||||
</object>
|
||||
@ -331,11 +331,21 @@
|
||||
</object>
|
||||
<object name="exploreMapText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
|
||||
<object name="exploreMap" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
|
||||
<translatableAttribute id="tooltip" comment="Make sure to differentiate between the revealed map and explored map options!">Toggle explored map (see gaia and buildings).</translatableAttribute>
|
||||
<translatableAttribute id="tooltip" comment="Make sure to differentiate between the revealed map and explored map options!">Toggle explored map (see initial map).</translatableAttribute>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object size="14 218 94% 246">
|
||||
<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
|
||||
<translatableAttribute id="caption">Disable Treasures:</translatableAttribute>
|
||||
</object>
|
||||
<object name="disableTreasuresText" size="40% 0 100% 28" type="text" style="ModernLeftLabelText"/>
|
||||
<object name="disableTreasures" size="40%+10 5 40%+30 100%-5" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip">
|
||||
<translatableAttribute id="tooltip">Disable all treasures on the map.</translatableAttribute>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object size="14 248 94% 276">
|
||||
<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
|
||||
<translatableAttribute id="caption">Teams Locked:</translatableAttribute>
|
||||
</object>
|
||||
@ -345,7 +355,7 @@
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object name="optionCheats" size="14 248 94% 276" hidden="true">
|
||||
<object name="optionCheats" size="14 278 94% 306" hidden="true">
|
||||
<object size="0 0 40% 28" type="text" style="ModernRightLabelText">
|
||||
<translatableAttribute id="caption">Cheats:</translatableAttribute>
|
||||
</object>
|
||||
@ -355,7 +365,7 @@
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object name="optionRating" size="14 278 94% 306" hidden="true">
|
||||
<object name="optionRating" size="14 308 94% 336" hidden="true">
|
||||
<object size="0 0 40% 28" hidden="false" type="text" style="ModernRightLabelText">
|
||||
<translatableAttribute id="caption">Rated Game:</translatableAttribute>
|
||||
</object>
|
||||
|
@ -25,6 +25,16 @@ function LoadMapSettings(settings)
|
||||
cmpRangeManager.SetLosRevealAll(-1, true);
|
||||
}
|
||||
|
||||
if (settings.DisableTreasures)
|
||||
{
|
||||
for (let ent of Engine.GetEntitiesWithInterface(IID_ResourceSupply))
|
||||
{
|
||||
let cmpResourceSupply = Engine.QueryInterface(ent, IID_ResourceSupply);
|
||||
if (cmpResourceSupply.GetType().generic == "treasure")
|
||||
Engine.DestroyEntity(ent);
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.CircularMap)
|
||||
{
|
||||
var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|
||||
|
Loading…
Reference in New Issue
Block a user