Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/BuildRestrictions.js
Show All 12 Lines | "<BuildRestrictions>" + | ||||
"</Distance>" + | "</Distance>" + | ||||
"</BuildRestrictions>" + | "</BuildRestrictions>" + | ||||
"</a:example>" + | "</a:example>" + | ||||
"<element name='PlacementType' a:help='Specifies the terrain type restriction for this building.'>" + | "<element name='PlacementType' a:help='Specifies the terrain type restriction for this building.'>" + | ||||
"<choice>" + | "<choice>" + | ||||
"<value>land</value>" + | "<value>land</value>" + | ||||
"<value>shore</value>" + | "<value>shore</value>" + | ||||
"<value>land-shore</value>"+ | "<value>land-shore</value>"+ | ||||
"<value>land-ignore-obstruction</value>"+ | |||||
"</choice>" + | "</choice>" + | ||||
"</element>" + | "</element>" + | ||||
"<element name='Territory' a:help='Specifies territory type restrictions for this building.'>" + | "<element name='Territory' a:help='Specifies territory type restrictions for this building.'>" + | ||||
"<list>" + | "<list>" + | ||||
"<oneOrMore>" + | "<oneOrMore>" + | ||||
"<choice>" + | "<choice>" + | ||||
"<value>own</value>" + | "<value>own</value>" + | ||||
"<value>ally</value>" + | "<value>ally</value>" + | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | case "shore": | ||||
break; | break; | ||||
case "land-shore": | case "land-shore": | ||||
// 'default-terrain-only' is everywhere a normal unit can go, ignoring | // 'default-terrain-only' is everywhere a normal unit can go, ignoring | ||||
// obstructions (i.e. on passable land, and not too deep in the water) | // obstructions (i.e. on passable land, and not too deep in the water) | ||||
passClassName = "default-terrain-only"; | passClassName = "default-terrain-only"; | ||||
break; | break; | ||||
case "land-ignore-obstruction": | |||||
passClassName = "building-land-no-obstruction"; | |||||
break; | |||||
case "land": | case "land": | ||||
default: | default: | ||||
passClassName = "building-land"; | passClassName = "building-land"; | ||||
} | } | ||||
var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | var cmpObstruction = Engine.QueryInterface(this.entity, IID_Obstruction); | ||||
if (!cmpObstruction) | if (!cmpObstruction) | ||||
return result; // Fail | return result; // Fail | ||||
if (this.template.Category == "Wall") | if (this.template.Category == "Wall") | ||||
{ | { | ||||
// for walls, only test the center point | // for walls, only test the center point | ||||
var ret = cmpObstruction.CheckFoundation(passClassName, true); | var ret = cmpObstruction.CheckFoundation(passClassName, true); | ||||
} | } | ||||
else if (this.template.PlacementType == "land-ignore-obstruction") | |||||
{ | |||||
// this is needed as the the <Obstructions>none</Obstructions> | |||||
// is not actually used when building | |||||
bb: Why not give the structure a different passclass? Like the one that passes everything (birds… | |||||
Done Inline ActionsThis is the main WIP point of this patch. I basically only want it to ignore obstructions from trees, but at the moment it also ignores obstructions from buildings ect. marder: This is the main WIP point of this patch. I basically only want it to ignore obstructions from… | |||||
Done Inline ActionsSo if there is somehow a passclass that allows that, or if you have an idea about how to create one, any tips would be much appreciated :) marder: So if there is somehow a passclass that allows that, or if you have an idea about how to create… | |||||
// it is rather assumed to be <Obstructions>foundation</Obstructions> | |||||
// by the c++ part. See palisades as another example who use | |||||
// land-shore but are still obstructed by foundations | |||||
var ret = "success"; | |||||
} | |||||
else | else | ||||
{ | { | ||||
var ret = cmpObstruction.CheckFoundation(passClassName, false); | var ret = cmpObstruction.CheckFoundation(passClassName, false); | ||||
} | } | ||||
if (ret != "success") | if (ret != "success") | ||||
{ | { | ||||
switch (ret) | switch (ret) | ||||
▲ Show 20 Lines • Show All 174 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Why not give the structure a different passclass? Like the one that passes everything (birds and mustangs have that currently), or maybe there is a terrain only thingy