diff --git a/OpenRA.Mods.RA/Bridge.cs b/OpenRA.Mods.RA/Bridge.cs index ebad07fc7f..57279b17b0 100644 --- a/OpenRA.Mods.RA/Bridge.cs +++ b/OpenRA.Mods.RA/Bridge.cs @@ -42,8 +42,6 @@ namespace OpenRA.Mods.RA public readonly ushort DestroyedPlusSouthTemplate; public readonly ushort DestroyedPlusBothTemplate; public readonly string[] ShorePieces = {"br1", "br2"}; - - public readonly bool UseAlternateNames = false; public readonly int[] NorthOffset = null; public readonly int[] SouthOffset = null; @@ -82,25 +80,24 @@ namespace OpenRA.Mods.RA ushort currentTemplate; Actor self; - BridgeInfo info; - Bridge northNeighbour, southNeighbour; - + BridgeInfo Info; public string Type; - + Bridge northNeighbour, southNeighbour; + public Bridge(Actor self, BridgeInfo info) { this.self = self; self.RemoveOnDeath = false; - this.info = info; + this.Info = info; this.Type = self.Info.Name; } public void Create(ushort template, Dictionary subtiles) { currentTemplate = template; - if (template == info.DamagedTemplate) + if (template == Info.DamagedTemplate) self.Health = (int)(self.World.Defaults.ConditionYellow*self.GetMaxHP()); - else if (template != info.Template) + else if (template != Info.Template) self.Health = 0; // Create a new cache to store the tile data @@ -113,7 +110,7 @@ namespace OpenRA.Mods.RA } // Cache templates and tiles for the different states - foreach (var t in info.Templates) + foreach (var t in Info.Templates) { Templates.Add(t,self.World.TileSet.Templates[t]); TileSprites.Add(t,subtiles.ToDictionary( @@ -132,11 +129,10 @@ namespace OpenRA.Mods.RA public void LinkNeighbouringBridges(World world, BridgeLayer bridges) { // go looking for our neighbors if this is a long bridge. - var info = self.Info.Traits.Get(); - if (info.NorthOffset != null) - northNeighbour = GetNeighbor(info.NorthOffset, bridges); - if (info.SouthOffset != null) - southNeighbour = GetNeighbor(info.SouthOffset, bridges); + if (Info.NorthOffset != null) + northNeighbour = GetNeighbor(Info.NorthOffset, bridges); + if (Info.SouthOffset != null) + southNeighbour = GetNeighbor(Info.SouthOffset, bridges); } public Bridge GetNeighbor(int[] offset, BridgeLayer bridges) @@ -156,28 +152,23 @@ namespace OpenRA.Mods.RA return b != null && b.self.IsInWorld && b.self.Health > 0; } - static bool IsLong(Bridge b) - { - return b != null && b.self.IsInWorld && b.self.Info.Traits.Get().Long; - } - void UpdateState() { var ds = self.GetDamageState(); // If this is a long bridge next to a destroyed shore piece, we need die to give clean edges to the break - if (info.Long && ds != DamageState.Dead && - ((southNeighbour != null && info.ShorePieces.Contains(southNeighbour.Type) && !IsIntact(southNeighbour)) || - (northNeighbour != null && info.ShorePieces.Contains(northNeighbour.Type) && !IsIntact(northNeighbour)))) + if (Info.Long && ds != DamageState.Dead && + ((southNeighbour != null && Info.ShorePieces.Contains(southNeighbour.Type) && !IsIntact(southNeighbour)) || + (northNeighbour != null && Info.ShorePieces.Contains(northNeighbour.Type) && !IsIntact(northNeighbour)))) { self.Health = 0; ds = DamageState.Dead; } - currentTemplate = (ds == DamageState.Half && info.DamagedTemplate > 0) ? info.DamagedTemplate : - (ds == DamageState.Dead && info.DestroyedTemplate > 0) ? info.DestroyedTemplate : info.Template; + currentTemplate = (ds == DamageState.Half && Info.DamagedTemplate > 0) ? Info.DamagedTemplate : + (ds == DamageState.Dead && Info.DestroyedTemplate > 0) ? Info.DestroyedTemplate : Info.Template; - if (!(info.Long && ds == DamageState.Dead)) + if (!(Info.Long && ds == DamageState.Dead)) return; // Long bridges have custom art for multiple segments being destroyed @@ -185,11 +176,11 @@ namespace OpenRA.Mods.RA bool waterToNorth = !IsIntact(northNeighbour); if (waterToSouth && waterToNorth) - currentTemplate = info.DestroyedPlusBothTemplate; + currentTemplate = Info.DestroyedPlusBothTemplate; else if (waterToNorth) - currentTemplate = info.DestroyedPlusNorthTemplate; + currentTemplate = Info.DestroyedPlusNorthTemplate; else if (waterToSouth) - currentTemplate = info.DestroyedPlusSouthTemplate; + currentTemplate = Info.DestroyedPlusSouthTemplate; } public void Damaged(Actor self, AttackInfo e) diff --git a/OpenRA.Mods.RA/BridgeLayer.cs b/OpenRA.Mods.RA/BridgeLayer.cs index 5091a8e955..b684b80c02 100644 --- a/OpenRA.Mods.RA/BridgeLayer.cs +++ b/OpenRA.Mods.RA/BridgeLayer.cs @@ -33,23 +33,20 @@ namespace OpenRA.Mods.RA class BridgeLayer : ILoadWorldHook, ITerrainTypeModifier { - // for tricky things like bridges. - Bridge[,] Bridges; - readonly BridgeLayerInfo Info; readonly World world; + Dictionary BridgeTypes = new Dictionary(); + Bridge[,] Bridges; + public BridgeLayer(Actor self, BridgeLayerInfo Info) { this.Info = Info; this.world = self.World; } - - static Dictionary BridgeTypes; public void WorldLoaded(World w) { Bridges = new Bridge[w.Map.MapSize.X, w.Map.MapSize.Y]; - BridgeTypes = new Dictionary(); // Build a list of templates that should be overlayed with bridges foreach(var bridge in Info.Bridges) diff --git a/mods/cnc/civilian.yaml b/mods/cnc/civilian.yaml index 4f4de772ff..dc74a28bcf 100644 --- a/mods/cnc/civilian.yaml +++ b/mods/cnc/civilian.yaml @@ -140,44 +140,44 @@ V18: Armor: wood BRIDGE1: + Inherits: ^Bridge Bridge: - UseAlternateNames: yes - Category: Building - Selectable: - BelowUnits: + Template: 165 + DestroyedTemplate: 166 Building: - Footprint: _____ _____ _____ - Dimensions: 5,3 - HP: 1000 + Footprint: ____ ____ ____ ____ + Dimensions: 4,4 + Selectable: + Bounds: 96,96 BRIDGE2: + Inherits: ^Bridge Bridge: - UseAlternateNames: yes - Category: Building - Selectable: - BelowUnits: + Template: 167 + DestroyedTemplate: 168 Building: - Footprint: _____ _____ - Dimensions: 5,2 - HP: 1000 + Footprint: _____ _____ _____ _____ _____ + Dimensions: 5,5 + Selectable: + Bounds: 120,120 BRIDGE3: + Inherits: ^Bridge Bridge: - UseAlternateNames: yes - Category: Building - Selectable: - BelowUnits: + Template: 169 + DestroyedTemplate: 170 Building: - Footprint: _____ _____ _____ - Dimensions: 5,3 - HP: 1000 + Footprint: ______ ______ ______ ______ ______ + Dimensions: 6,5 + Selectable: + Bounds: 144,120 BRIDGE4: + Inherits: ^Bridge Bridge: - UseAlternateNames: yes - Category: Building - Selectable: - BelowUnits: + Template: 171 + DestroyedTemplate: 172 Building: - Footprint: _____ _____ - Dimensions: 5,2 - HP: 1000 + Footprint: ______ ______ ______ ______ + Dimensions: 6,4 + Selectable: + Bounds: 144,96 \ No newline at end of file diff --git a/mods/cnc/compat.yaml b/mods/cnc/compat.yaml deleted file mode 100644 index 23a66dab33..0000000000 --- a/mods/cnc/compat.yaml +++ /dev/null @@ -1,34 +0,0 @@ -BR1: - Bridge: - SouthOffset: 0,2 - Category: Building - Selectable: - BelowUnits: - Building: - Footprint: ____ ____ - Dimensions: 4,2 - HP: 1000 - -BR2: - Bridge: - NorthOffset: 3,0 - Category: Building - Selectable: - BelowUnits: - Building: - Footprint: ____ ____ - Dimensions: 4,2 - HP: 1000 - -BR3: - Bridge: - Long: yes - NorthOffset: 2,0 - SouthOffset: 0,1 - Category: Building - Selectable: - BelowUnits: - Building: - Footprint: ____ ____ - Dimensions: 4,2 - HP: 1000 diff --git a/mods/cnc/defaults.yaml b/mods/cnc/defaults.yaml index 742bca9fb2..3e0077acde 100644 --- a/mods/cnc/defaults.yaml +++ b/mods/cnc/defaults.yaml @@ -143,4 +143,18 @@ Priority: -1 HiddenUnderFog: RevealsShroud: - Burns: \ No newline at end of file + Burns: + +^Bridge: + Category: Building + Valued: + Description: Bridge + Selectable: + Bounds: 96,96 + BelowUnits: + Building: + DamagedSound: xplos.aud + DestroyedSound: xplobig4.aud + Footprint: ______ ______ ______ ______ + Dimensions: 6,4 + HP: 1000 \ No newline at end of file diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 3960e2bb52..a362084af6 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -24,7 +24,6 @@ Rules: mods/cnc/vehicles.yaml: mods/cnc/trees.yaml: mods/cnc/civilian.yaml: Civilian structures and bridges - mods/cnc/compat.yaml: Compatability tweaks for real-ra maps Sequences: mods/cnc/sequences-structures.xml: diff --git a/mods/cnc/system.yaml b/mods/cnc/system.yaml index 970b4c6207..bb0bd33325 100644 --- a/mods/cnc/system.yaml +++ b/mods/cnc/system.yaml @@ -49,7 +49,8 @@ World: UnitInfluence: AircraftInfluence: HazardLayer: -# BridgeLoadHook: + BridgeLayer: + Bridges: bridge1, bridge2, bridge3, bridge4 PaletteFromFile@terrain_desert: Name: terrain Theater: desert diff --git a/mods/cnc/tileset-des.yaml b/mods/cnc/tileset-des.yaml index cc8c715f63..0dde6af05d 100644 --- a/mods/cnc/tileset-des.yaml +++ b/mods/cnc/tileset-des.yaml @@ -1218,7 +1218,6 @@ Templates: Id: 169 Image: bridge3 Size: 6,5 - Bridge: bridge3 Tiles: 4: Road 7: Rock @@ -1241,7 +1240,6 @@ Templates: Id: 170 Image: bridge3d Size: 6,5 - Bridge: bridge3 Tiles: 4: Road 7: Rock @@ -1264,7 +1262,6 @@ Templates: Id: 171 Image: bridge4 Size: 6,4 - Bridge: bridge4 Tiles: 1: Road 3: Tree @@ -1288,7 +1285,6 @@ Templates: Id: 172 Image: bridge4d Size: 6,4 - Bridge: bridge4 Tiles: 1: Road 3: Tree diff --git a/mods/cnc/tileset-tem.yaml b/mods/cnc/tileset-tem.yaml index 04d75fdf42..822eacd88c 100644 --- a/mods/cnc/tileset-tem.yaml +++ b/mods/cnc/tileset-tem.yaml @@ -1203,7 +1203,6 @@ Templates: Id: 165 Image: bridge1 Size: 4,4 - Bridge: bridge1 Tiles: 3: Road 4: River @@ -1220,7 +1219,6 @@ Templates: Id: 166 Image: bridge1d Size: 4,4 - Bridge: bridge1 Tiles: 3: Road 4: River @@ -1237,7 +1235,6 @@ Templates: Id: 167 Image: bridge2 Size: 5,5 - Bridge: bridge2 Tiles: 0: Road 5: Wall @@ -1256,7 +1253,6 @@ Templates: Id: 168 Image: bridge2d Size: 5,5 - Bridge: bridge2 Tiles: 0: Road 5: Wall diff --git a/mods/cnc/tileset-win.yaml b/mods/cnc/tileset-win.yaml index 543ec5cde5..03986a7cf6 100644 --- a/mods/cnc/tileset-win.yaml +++ b/mods/cnc/tileset-win.yaml @@ -1184,7 +1184,6 @@ Templates: Id: 165 Image: bridge1 Size: 4,4 - Bridge: bridge1 Tiles: 3: Road 4: River @@ -1201,7 +1200,6 @@ Templates: Id: 166 Image: bridge1d Size: 4,4 - Bridge: bridge1 Tiles: 3: Road 4: River @@ -1218,7 +1216,6 @@ Templates: Id: 167 Image: bridge2 Size: 5,5 - Bridge: bridge2 Tiles: 0: Road 5: Wall @@ -1237,7 +1234,6 @@ Templates: Id: 168 Image: bridge2d Size: 5,5 - Bridge: bridge2 Tiles: 0: Road 5: Wall diff --git a/mods/ra/civilian.yaml b/mods/ra/civilian.yaml index b21bfb1c91..eb3ed2b1df 100644 --- a/mods/ra/civilian.yaml +++ b/mods/ra/civilian.yaml @@ -427,7 +427,6 @@ BRIDGE1: Template: 131 DamagedTemplate: 378 DestroyedTemplate: 132 - UseAlternateNames: yes Building: Footprint: _____ _____ _____ Dimensions: 5,3 @@ -439,7 +438,6 @@ BRIDGE2: Template: 133 DamagedTemplate: 379 DestroyedTemplate: 134 - UseAlternateNames: yes Building: Footprint: _____ _____ Dimensions: 5,2