split bridges to use different actor types for the various bridge types

This commit is contained in:
Chris Forbes
2010-01-19 12:37:11 +13:00
parent eb81076bce
commit df8f37c5e4
5 changed files with 57 additions and 19 deletions

View File

@@ -9,7 +9,7 @@ namespace OpenRa.FileFormats
public int Index;
public string Name;
public int2 Size;
public bool IsBridge;
public string Bridge;
public float HP;
public Dictionary<int, int> TerrainType = new Dictionary<int, int>();
}
@@ -37,7 +37,7 @@ namespace OpenRa.FileFormats
p => int.Parse(p.Value)),
Name = section.GetValue("Name", null).ToLowerInvariant(),
Index = int.Parse(section.Name.Substring(3)),
IsBridge = section.GetValue("bridge", "no") != "no",
Bridge = section.GetValue("bridge", null),
HP = float.Parse(section.GetValue("hp", "0"))
};

View File

@@ -50,7 +50,7 @@ namespace OpenRa
if (replacedTiles.Any())
{
var a = w.CreateActor("Bridge", new int2(ni, nj), null);
var a = w.CreateActor(template.Bridge, new int2(ni, nj), null);
var br = a.traits.Get<Bridge>();
br.SetTiles(w, template, replacedTiles);
}
@@ -58,7 +58,7 @@ namespace OpenRa
static bool IsBridge(World w, ushort t)
{
return w.TileSet.walk[t].IsBridge;
return w.TileSet.walk[t].Bridge != null;
}
}
}

22
ra.yaml
View File

@@ -1437,7 +1437,27 @@ DOMF:
Image: DOME
Fake:
BRIDGE:
BR1:
Category: Building
Selectable:
Bridge:
BelowUnits:
Building:
Footprint: ____ ____
Dimensions: 4,2
HP: 1000
BR2:
Category: Building
Selectable:
Bridge:
BelowUnits:
Building:
Footprint: ____ ____
Dimensions: 4,2
HP: 1000
BR3:
Category: Building
Selectable:
Bridge:

View File

@@ -2491,7 +2491,7 @@ tiletype3=3
Name=BR1A
width=4
height=3
bridge=yes
bridge=br1
hp=1
tiletype1=3
tiletype2=2
@@ -2507,7 +2507,7 @@ tiletype11=3
Name=BR1B
width=4
height=3
bridge=yes
bridge=br1
hp=.5
tiletype1=3
tiletype2=6
@@ -2523,7 +2523,7 @@ tiletype11=3
Name=BR1C
width=4
height=3
bridge=yes
bridge=br1
hp=0
tiletype1=3
tiletype2=3
@@ -2539,7 +2539,7 @@ tiletype11=3
Name=BR2A
width=5
height=3
bridge=yes
bridge=br2
hp=1
tiletype1=3
tiletype2=2
@@ -2556,7 +2556,7 @@ tiletype13=3
Name=BR2B
width=5
height=3
bridge=yes
bridge=br2
hp=.5
tiletype1=3
tiletype2=6
@@ -2573,7 +2573,7 @@ tiletype13=3
Name=BR2C
width=5
height=3
bridge=yes
bridge=br2
hp=0
tiletype1=1
tiletype2=1
@@ -2590,7 +2590,7 @@ tiletype13=3
Name=BR3A
width=4
height=2
bridge=yes
bridge=br3
hp=1
tiletype0=3
tiletype1=2
@@ -2602,7 +2602,7 @@ tiletype7=3
Name=BR3B
width=4
height=2
bridge=yes
bridge=br3
hp=.5
tiletype0=3
tiletype1=2
@@ -2614,7 +2614,7 @@ tiletype7=3
Name=BR3C
width=4
height=2
bridge=yes
bridge=br3
hp=0
tiletype0=3
tiletype1=3
@@ -2626,7 +2626,7 @@ tiletype7=3
Name=BR3D
width=4
height=2
bridge=yes
bridge=br3
hp=0
tiletype0=5
tiletype1=3
@@ -2638,7 +2638,7 @@ tiletype7=5
Name=BR3E
width=4
height=2
bridge=yes
bridge=br3
hp=0
tiletype0=1
tiletype1=1
@@ -2650,7 +2650,7 @@ tiletype7=1
Name=BR3F
width=4
height=2
bridge=yes
bridge=br3
hp=0
tiletype0=1
tiletype1=1

View File

@@ -253,7 +253,9 @@ DOMF
; pseudo-buildings
MINP
MINV
BRIDGE
BR1
BR2
BR3
; `Dimensions` is the size of a box that will include the whole building, excluding bib.
@@ -534,13 +536,29 @@ Selectable=no
Traits=Unit,RenderUnit,BelowUnits,InvisibleToOthers
Selectable=no
[Bridge]
[BR1]
Traits=Bridge, BelowUnits, Building
Strength=1000
Dimensions=4,2
Footprint=____ ____
Selectable=yes
[BR2]
Traits=Bridge, BelowUnits, Building
Strength=1000
Dimensions=4,2
Footprint=____ ____
Selectable=yes ;; temp hack
[BR3]
Traits=Bridge, BelowUnits, Building
Strength=1000
Dimensions=4,2
Footprint=____ ____
Selectable=yes ;; temp hack
;; todo: short bridges
[InfantryTypes]
DOG
E1