mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 14:43:52 +00:00
Remove civ-specific hardcoding in rmgen wall-placement script.
Original Patch By: FeXoR Reviewed By: FeXoR Commented On By: elexis Refs #2944 Differential Revision: https://code.wildfiregames.com/D900 This was SVN commit r20625.
This commit is contained in:
@@ -219,7 +219,7 @@ function GetTemplateDataHelper(template, player, auraTemplates, resources, damag
|
||||
ret.deathDamage[damageType] = getEntityValue("DeathDamage/" + damageType);
|
||||
}
|
||||
|
||||
if (template.Auras)
|
||||
if (template.Auras && auraTemplates)
|
||||
{
|
||||
ret.auras = {};
|
||||
for (let auraID of template.Auras._string.split(/\s+/))
|
||||
@@ -438,20 +438,32 @@ function GetTemplateDataHelper(template, player, auraTemplates, resources, damag
|
||||
};
|
||||
|
||||
if (template.WallSet)
|
||||
{
|
||||
ret.wallSet = {
|
||||
"templates": {
|
||||
"tower": template.WallSet.Templates.Tower,
|
||||
"gate": template.WallSet.Templates.Gate,
|
||||
"fort": template.WallSet.Templates.Fort || "structures/" + template.Identity.Civ + "_fortress",
|
||||
"long": template.WallSet.Templates.WallLong,
|
||||
"medium": template.WallSet.Templates.WallMedium,
|
||||
"short": template.WallSet.Templates.WallShort,
|
||||
"short": template.WallSet.Templates.WallShort
|
||||
},
|
||||
"maxTowerOverlap": +template.WallSet.MaxTowerOverlap,
|
||||
"minTowerOverlap": +template.WallSet.MinTowerOverlap,
|
||||
"minTowerOverlap": +template.WallSet.MinTowerOverlap
|
||||
};
|
||||
if (template.WallSet.Templates.WallEnd)
|
||||
ret.wallSet.templates.end = template.WallSet.Templates.WallEnd;
|
||||
if (template.WallSet.Templates.WallCurves)
|
||||
ret.wallSet.templates.curves = template.WallSet.Templates.WallCurves.split(" ");
|
||||
}
|
||||
|
||||
if (template.WallPiece)
|
||||
ret.wallPiece = { "length": +template.WallPiece.Length };
|
||||
ret.wallPiece = {
|
||||
"length": +template.WallPiece.Length,
|
||||
"angle": +(template.WallPiece.Orientation || 1) * Math.PI,
|
||||
"indent": +(template.WallPiece.Indent || 0),
|
||||
"bend": +(template.WallPiece.Bend || 0) * Math.PI
|
||||
};
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -228,6 +228,9 @@ function loadStructure(templateName)
|
||||
|
||||
for (let wSegm in structure.wallSet.templates)
|
||||
{
|
||||
if (wSegm == "fort" || wSegm == "curves")
|
||||
continue;
|
||||
|
||||
let wPart = loadStructure(structure.wallSet.templates[wSegm]);
|
||||
structure.wallset[wSegm] = wPart;
|
||||
|
||||
@@ -249,6 +252,15 @@ function loadStructure(templateName)
|
||||
health.min = Math.min(health.min, wPart.health);
|
||||
health.max = Math.max(health.max, wPart.health);
|
||||
}
|
||||
|
||||
if (structure.wallSet.templates.curves)
|
||||
for (let curve of structure.wallSet.templates.curves)
|
||||
{
|
||||
let wPart = loadStructure(curve);
|
||||
health.min = Math.min(health.min, wPart.health);
|
||||
health.max = Math.max(health.max, wPart.health);
|
||||
}
|
||||
|
||||
if (health.min == health.max)
|
||||
structure.health = health.min;
|
||||
else
|
||||
|
||||
@@ -5,6 +5,8 @@ const SEA_LEVEL = 20.0;
|
||||
const HEIGHT_UNITS_PER_METRE = 92;
|
||||
const MAP_BORDER_WIDTH = 3;
|
||||
|
||||
const g_DamageTypes = new DamageTypes();
|
||||
|
||||
/**
|
||||
* Constants needed for heightmap_manipulation.js
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1247,6 +1247,9 @@ GuiInterface.prototype.SetWallPlacementPreview = function(player, cmd)
|
||||
// Create cache entries for templates we haven't seen before
|
||||
for (let type in wallSet.templates)
|
||||
{
|
||||
if (type == "curves")
|
||||
continue;
|
||||
|
||||
let tpl = wallSet.templates[type];
|
||||
if (!(tpl in this.placementWallEntities))
|
||||
{
|
||||
|
||||
@@ -21,6 +21,21 @@ WallSet.prototype.Schema =
|
||||
"<element name='WallShort' a:help='Template name of the short wall segment'>" +
|
||||
"<text/>" +
|
||||
"</element>" +
|
||||
"<optional>" +
|
||||
"<element name='WallCurves' a:help='Space-separated list of template names of curving wall segments.'>" +
|
||||
"<text/>" +
|
||||
"</element>" +
|
||||
"</optional>" +
|
||||
"<optional>" +
|
||||
"<element name='WallEnd'>" +
|
||||
"<text/>" +
|
||||
"</element>" +
|
||||
"</optional>" +
|
||||
"<optional>" +
|
||||
"<element name='Fort'>" +
|
||||
"<text/>" +
|
||||
"</element>" +
|
||||
"</optional>" +
|
||||
"</interleave>" +
|
||||
"</element>" +
|
||||
"<element name='MinTowerOverlap' a:help='Maximum fraction that wall segments are allowed to overlap towers, where 0 signifies no overlap and 1 full overlap'>" +
|
||||
|
||||
@@ -110,6 +110,11 @@
|
||||
"Special":"Train heroes and research technology pertaining to heroes."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/athen_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -88,6 +88,11 @@
|
||||
"Special": ""
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/brit_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -113,6 +113,12 @@
|
||||
"Special":"Hire Iberian mercenaries."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/cart_wallset_short",
|
||||
"structures/cart_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -88,6 +88,11 @@
|
||||
"Special": ""
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/gaul_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -86,6 +86,11 @@
|
||||
"Special": "Defensive Aura - Gives all Iberian units and buildings within vision range of the monument a 10-15% attack boost. Build Limit: Only 5 may be built per map."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/iber_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -115,6 +115,11 @@
|
||||
"Special":"Constructs and upgrades all Macedonian siege engines."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/mace_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -96,6 +96,11 @@
|
||||
"Special":"Contentment: +10% Health and +10% resource gathering rates for all citizens and allied citizens within its range. Can be built anywhere except in enemy territory. Max Built: 10."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/maur_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -106,6 +106,11 @@
|
||||
"Special": "Train heroes and Persian Immortals. Gives a slow trickle of all resources as 'Satrapy Tribute.'"
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/pers_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -115,6 +115,11 @@
|
||||
"Special":"When built along the shoreline, removes shroud of darkness over all the water, revealing all the coast lines on the map. Limit: 1."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/ptol_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -90,6 +90,11 @@
|
||||
"Special": "Can be built in neutral and enemy territory to strangle enemy towns."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"structures/rome_wallset_stone",
|
||||
"structures/rome_wallset_siege"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -114,6 +114,11 @@
|
||||
"Special":"This is the Seleucid expansion building, similar to Civic Centers for other factions. It is weaker and carries a smaller territory influence, but is cheaper and built faster."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/sele_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -106,6 +106,11 @@
|
||||
"Special":"Train heroes and Spartiates and research technologies related to them."
|
||||
}
|
||||
],
|
||||
"WallSets":
|
||||
[
|
||||
"other/wallset_palisade",
|
||||
"structures/spart_wallset_stone"
|
||||
],
|
||||
"StartEntities":
|
||||
[
|
||||
{
|
||||
|
||||
@@ -12,9 +12,14 @@
|
||||
<Templates>
|
||||
<Tower>other/palisades_rocks_tower</Tower>
|
||||
<Gate>other/palisades_rocks_gate</Gate>
|
||||
<Fort>other/palisades_rocks_fort</Fort>
|
||||
<WallLong>other/palisades_rocks_long</WallLong>
|
||||
<WallMedium>other/palisades_rocks_medium</WallMedium>
|
||||
<WallShort>other/palisades_rocks_short</WallShort>
|
||||
<WallCurves>
|
||||
other/palisades_rocks_curve
|
||||
</WallCurves>
|
||||
<WallEnd>other/palisades_rocks_end</WallEnd>
|
||||
</Templates>
|
||||
</WallSet>
|
||||
</Entity>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<Templates>
|
||||
<Tower>structures/rome_siege_wall_tower</Tower>
|
||||
<Gate>structures/rome_siege_wall_gate</Gate>
|
||||
<Fort>structures/rome_army_camp</Fort>
|
||||
<WallLong>structures/rome_siege_wall_long</WallLong>
|
||||
<WallMedium>structures/rome_siege_wall_medium</WallMedium>
|
||||
<WallShort>structures/rome_siege_wall_short</WallShort>
|
||||
|
||||
Reference in New Issue
Block a user