bridge setup as trait; wired to RA & CNC
This commit is contained in:
@@ -73,7 +73,6 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Bridges.cs" />
|
||||
<Compile Include="Chat.cs" />
|
||||
<Compile Include="Chrome.cs" />
|
||||
<Compile Include="Combat.cs" />
|
||||
@@ -118,6 +117,7 @@
|
||||
<Compile Include="Support\OpenAlInterop.cs" />
|
||||
<Compile Include="Support\PerfHistory.cs" />
|
||||
<Compile Include="Sync.cs" />
|
||||
<Compile Include="Traits\BridgeLoadHook.cs" />
|
||||
<Compile Include="Traits\ChoosePaletteOnSelect.cs" />
|
||||
<Compile Include="Traits\CrateSpawner.cs" />
|
||||
<Compile Include="Traits\OreGrowth.cs" />
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRa.Traits;
|
||||
|
||||
namespace OpenRa
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
static class Bridges
|
||||
class BridgeLoadHookInfo : StatelessTraitInfo<BridgeLoadHook> { }
|
||||
|
||||
class BridgeLoadHook : ILoadWorldHook
|
||||
{
|
||||
public static void MakeBridges(World w)
|
||||
static void MakeBridges(World w)
|
||||
{
|
||||
var mini = w.Map.XOffset; var maxi = w.Map.XOffset + w.Map.Width;
|
||||
var minj = w.Map.YOffset; var maxj = w.Map.YOffset + w.Map.Height;
|
||||
@@ -40,8 +41,8 @@ namespace OpenRa
|
||||
if (!template.TerrainType.ContainsKey(n)) continue;
|
||||
|
||||
if (w.Map.IsInMap(x, y))
|
||||
if (w.Map.MapTiles[x, y].tile == tile
|
||||
&& w.Map.MapTiles[x,y].image == n)
|
||||
if (w.Map.MapTiles[x, y].tile == tile
|
||||
&& w.Map.MapTiles[x, y].image == n)
|
||||
{
|
||||
// stash it
|
||||
replacedTiles[new int2(x, y)] = w.Map.MapTiles[x, y].image;
|
||||
@@ -63,5 +64,7 @@ namespace OpenRa
|
||||
{
|
||||
return w.TileSet.walk[t].Bridge != null;
|
||||
}
|
||||
|
||||
public void WorldLoaded(World w) { MakeBridges(w); }
|
||||
}
|
||||
}
|
||||
@@ -102,4 +102,5 @@ namespace OpenRa.Traits
|
||||
public interface ITraitPrerequisite<T> { }
|
||||
|
||||
public interface INotifySelection { void SelectionChanged(); }
|
||||
public interface ILoadWorldHook { void WorldLoaded(World w); }
|
||||
}
|
||||
|
||||
@@ -77,9 +77,11 @@ namespace OpenRa
|
||||
Queries = new AllQueries( this );
|
||||
Timer.Time( "queries: {0}" );
|
||||
|
||||
Bridges.MakeBridges(this);
|
||||
foreach (var wlh in WorldActor.traits.WithInterface<ILoadWorldHook>())
|
||||
wlh.WorldLoaded(this);
|
||||
|
||||
PathFinder = new PathFinder(this);
|
||||
Timer.Time( "bridge, pathing: {0}" );
|
||||
Timer.Time( "hooks, pathing: {0}" );
|
||||
|
||||
Minimap = new Minimap(this, Game.renderer);
|
||||
Timer.Time( "minimap: {0}" );
|
||||
|
||||
@@ -14,6 +14,7 @@ World:
|
||||
WaterPaletteRotation:
|
||||
BuildingInfluence:
|
||||
UnitInfluence:
|
||||
BridgeLoadHook:
|
||||
PaletteFromFile@terrain_temperat:
|
||||
Name: terrain
|
||||
Theater: temperat
|
||||
|
||||
@@ -72,6 +72,7 @@ World:
|
||||
BuildingInfluence:
|
||||
UnitInfluence:
|
||||
ChoosePaletteOnSelect:
|
||||
BridgeLoadHook:
|
||||
PaletteFromFile@terrain_temperat:
|
||||
Name: terrain
|
||||
Filename: temperat.pal
|
||||
|
||||
Reference in New Issue
Block a user