Tie Minimap to ProvidesRadar trait
This commit is contained in:
@@ -143,16 +143,21 @@ namespace OpenRa.Game
|
|||||||
DrawPower();
|
DrawPower();
|
||||||
chromeRenderer.Flush();
|
chromeRenderer.Flush();
|
||||||
DrawButtons();
|
DrawButtons();
|
||||||
|
DrawMinimap();
|
||||||
int paletteHeight = DrawBuildPalette(currentTab);
|
int paletteHeight = DrawBuildPalette(currentTab);
|
||||||
DrawBuildTabs(paletteHeight);
|
DrawBuildTabs(paletteHeight);
|
||||||
DrawChat();
|
DrawChat();
|
||||||
|
|
||||||
Game.minimap.Draw(new float2(Game.viewport.Width - 128,30));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawMinimap()
|
||||||
|
{
|
||||||
|
var hasRadar = Game.world.Actors.Any(a => a.Owner == Game.LocalPlayer && a.traits.Contains<ProvidesRadar>() && a.traits.Get<ProvidesRadar>().IsActive());
|
||||||
|
if (hasRadar)
|
||||||
|
Game.minimap.Draw(new float2(Game.viewport.Width - 128, 30));
|
||||||
|
}
|
||||||
|
|
||||||
void AddButton(Rectangle r, Action<bool> b) { buttons.Add(Pair.New(r, b)); }
|
void AddButton(Rectangle r, Action<bool> b) { buttons.Add(Pair.New(r, b)); }
|
||||||
|
|
||||||
void DrawBuildTabs(int paletteHeight)
|
void DrawBuildTabs(int paletteHeight)
|
||||||
{
|
{
|
||||||
const int tabWidth = 24;
|
const int tabWidth = 24;
|
||||||
|
|||||||
@@ -214,6 +214,7 @@
|
|||||||
<Compile Include="Traits\MineImmune.cs" />
|
<Compile Include="Traits\MineImmune.cs" />
|
||||||
<Compile Include="Traits\Minelayer.cs" />
|
<Compile Include="Traits\Minelayer.cs" />
|
||||||
<Compile Include="Traits\LimitedAmmo.cs" />
|
<Compile Include="Traits\LimitedAmmo.cs" />
|
||||||
|
<Compile Include="Traits\ProvidesRadar.cs" />
|
||||||
<Compile Include="Traits\Repairable.cs" />
|
<Compile Include="Traits\Repairable.cs" />
|
||||||
<Compile Include="Traits\Reservable.cs" />
|
<Compile Include="Traits\Reservable.cs" />
|
||||||
<Compile Include="Traits\SquishByTank.cs" />
|
<Compile Include="Traits\SquishByTank.cs" />
|
||||||
|
|||||||
28
OpenRa.Game/Traits/ProvidesRadar.cs
Normal file
28
OpenRa.Game/Traits/ProvidesRadar.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OpenRa.Game.Traits
|
||||||
|
{
|
||||||
|
class ProvidesRadar
|
||||||
|
{
|
||||||
|
Actor self;
|
||||||
|
public ProvidesRadar(Actor self)
|
||||||
|
{
|
||||||
|
this.self = self;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsActive()
|
||||||
|
{
|
||||||
|
// TODO: Check for nearby MRJ
|
||||||
|
|
||||||
|
// Check if powered
|
||||||
|
var b = self.traits.Get<Building>();
|
||||||
|
if (b != null && b.InsuffientPower())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -407,7 +407,7 @@ SpawnOffset=0,-4
|
|||||||
LongDesc=Produces and reloads helicopters
|
LongDesc=Produces and reloads helicopters
|
||||||
[DOME]
|
[DOME]
|
||||||
Description=Radar Dome
|
Description=Radar Dome
|
||||||
Traits=Building, RenderBuilding
|
Traits=Building, RenderBuilding, ProvidesRadar
|
||||||
Dimensions=2,2
|
Dimensions=2,2
|
||||||
Footprint=xx xx
|
Footprint=xx xx
|
||||||
SelectionPriority=3
|
SelectionPriority=3
|
||||||
|
|||||||
Reference in New Issue
Block a user