Actual code changes from last commit, plus: IPips interface for displaying pips in the UI, ChronoshiftDeploy trait for Chronotank (teleport not yet working)
This commit is contained in:
@@ -56,7 +56,7 @@ namespace OpenRa.Game
|
||||
{
|
||||
var projectile = Rules.ProjectileInfo[weapon.Projectile];
|
||||
|
||||
if (projectile.ASW && target.traits.Contains<Cloak>()) return true;
|
||||
if (projectile.ASW && target.traits.Contains<Submarine>()) return true;
|
||||
if (projectile.AA && target.traits.Contains<Helicopter>()) return true;
|
||||
if (projectile.UnderWater && !target.Info.WaterBound) return false;
|
||||
return projectile.AG;
|
||||
|
||||
@@ -142,6 +142,12 @@ namespace OpenRa.Game
|
||||
return Cursor.Deploy;
|
||||
else
|
||||
return Cursor.DeployBlocked;
|
||||
case "ActivatePortableChronoshift": return Cursor.Deploy;
|
||||
case "UsePortableChronoshift":
|
||||
if (Game.IsCellBuildable(location, a.Info.WaterBound ? UnitMovementType.Float : UnitMovementType.Wheel, a))
|
||||
return Cursor.Chronoshift;
|
||||
else
|
||||
return Cursor.MoveBlocked;
|
||||
case "DeliverOre": return Cursor.Enter;
|
||||
case "Harvest": return Cursor.Attack; // TODO: special harvest cursor?
|
||||
default:
|
||||
|
||||
@@ -22,5 +22,6 @@ namespace OpenRa.Game
|
||||
public static Cursor Deploy { get { return new Cursor("deploy"); } }
|
||||
public static Cursor Enter { get { return new Cursor("enter"); } }
|
||||
public static Cursor DeployBlocked { get { return new Cursor("deploy-blocked"); } }
|
||||
public static Cursor Chronoshift { get { return new Cursor("chrono"); } }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,44 @@ namespace OpenRa.Game.Graphics
|
||||
lineRenderer.DrawLine(xy + new float2(0, -4),
|
||||
z + new float2(0, -4),
|
||||
healthColor2, healthColor2);
|
||||
|
||||
// Render Pips
|
||||
var pips = selectedUnit.traits.WithInterface<IPips>().FirstOrDefault();
|
||||
if (pips != null)
|
||||
{
|
||||
const int pipSize = 2; // How big are the pips?
|
||||
int pipCount = pips.GetPipCount();
|
||||
Color pipBorderColor = pips.GetBorderColor();
|
||||
float2 pipxy = xY + new float2(1, -1);
|
||||
|
||||
// Draw the border
|
||||
lineRenderer.DrawLine(pipxy,
|
||||
pipxy + new float2(pipCount * (pipSize + 1) + 1, 0),
|
||||
pipBorderColor, pipBorderColor);
|
||||
|
||||
lineRenderer.DrawLine(pipxy + new float2(0, -(pipSize + 1)),
|
||||
pipxy + new float2(pipCount * (pipSize + 1) + 1, -(pipSize + 1)),
|
||||
pipBorderColor, pipBorderColor);
|
||||
|
||||
// Draw vertical dividers
|
||||
for (int i = 0; i <= pipCount; i++)
|
||||
{
|
||||
lineRenderer.DrawLine(pipxy + new float2(i * (pipSize + 1), -(pipSize + 1)),
|
||||
pipxy + new float2(i * (pipSize + 1), 0),
|
||||
pipBorderColor, pipBorderColor);
|
||||
}
|
||||
|
||||
// Draw pips
|
||||
for (int i = 0; i < pipCount; i++)
|
||||
{
|
||||
Color pipColor = pips.GetColorForPip(i);
|
||||
if (pipColor == Color.Transparent) continue; // Empty pip
|
||||
|
||||
lineRenderer.DrawLine(pipxy + new float2(1 + i * (pipSize + 1), -2),
|
||||
pipxy + new float2(1 + i * (pipSize + 1) + pipSize, -2),
|
||||
pipColor, pipColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ShowUnitPaths)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
@@ -128,6 +128,7 @@
|
||||
<Compile Include="Graphics\LineRenderer.cs" />
|
||||
<Compile Include="Graphics\OverlayRenderer.cs" />
|
||||
<Compile Include="Graphics\WorldRenderer.cs" />
|
||||
<Compile Include="Traits\Activities\Teleport.cs" />
|
||||
<Compile Include="BuildingInfluenceMap.cs" />
|
||||
<Compile Include="IOrderGenerator.cs" />
|
||||
<Compile Include="PlaceBuilding.cs" />
|
||||
@@ -161,6 +162,7 @@
|
||||
<Compile Include="Traits\AttackTurreted.cs" />
|
||||
<Compile Include="Traits\AutoTarget.cs" />
|
||||
<Compile Include="Traits\Building.cs" />
|
||||
<Compile Include="Traits\ChronoshiftDeploy.cs" />
|
||||
<Compile Include="Traits\Harvester.cs" />
|
||||
<Compile Include="Traits\Helicopter.cs" />
|
||||
<Compile Include="Traits\ProductionQueue.cs" />
|
||||
@@ -183,6 +185,7 @@
|
||||
<Compile Include="Traits\RenderUnitSpinner.cs" />
|
||||
<Compile Include="Traits\RenderUnitTurreted.cs" />
|
||||
<Compile Include="Traits\SeedsOre.cs" />
|
||||
<Compile Include="Traits\Submarine.cs" />
|
||||
<Compile Include="Traits\TakeCover.cs" />
|
||||
<Compile Include="Traits\TraitsInterfaces.cs" />
|
||||
<Compile Include="Traits\Tree.cs" />
|
||||
|
||||
@@ -149,6 +149,16 @@ namespace OpenRa.Game
|
||||
return new Order("Move", subject, null, target, null);
|
||||
}
|
||||
|
||||
public static Order ActivatePortableChronoshift(Actor subject)
|
||||
{
|
||||
return new Order("ActivatePortableChronoshift", subject, null, int2.Zero, null);
|
||||
}
|
||||
|
||||
public static Order UsePortableChronoshift(Actor subject, int2 target)
|
||||
{
|
||||
return new Order("UsePortableChronoshift", subject, null, target, null);
|
||||
}
|
||||
|
||||
public static Order DeployMcv(Actor subject)
|
||||
{
|
||||
return new Order("DeployMcv", subject, null, int2.Zero, null);
|
||||
|
||||
@@ -18,11 +18,17 @@ namespace OpenRa.Game
|
||||
{
|
||||
if( mi.Button == MouseButton.Left )
|
||||
{
|
||||
if( !Game.CanPlaceBuilding( Building, xy, null, true ) )
|
||||
yield break;
|
||||
if (!Game.CanPlaceBuilding(Building, xy, null, true))
|
||||
{
|
||||
Sound.Play("nodeply1.aud");
|
||||
yield break;
|
||||
}
|
||||
|
||||
if (!Game.IsCloseEnoughToBase(Producer.Owner, Building, xy))
|
||||
yield break;
|
||||
if (!Game.IsCloseEnoughToBase(Producer.Owner, Building, xy))
|
||||
{
|
||||
Sound.Play("nodeply1.aud");
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return OpenRa.Game.Order.PlaceBuilding( Producer.Owner, xy, Building.Name );
|
||||
}
|
||||
|
||||
@@ -6,22 +6,22 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
class Cloak : IRenderModifier, INotifyAttack, ITick
|
||||
{
|
||||
int remainingSurfaceTime = 2; /* setup for initial dive */
|
||||
int remainingUncloakTime = 2; /* setup for initial cloak */
|
||||
|
||||
public Cloak(Actor self) {}
|
||||
|
||||
public void Attacking(Actor self)
|
||||
{
|
||||
if (remainingSurfaceTime <= 0)
|
||||
OnSurface();
|
||||
if (remainingUncloakTime <= 0)
|
||||
OnCloak();
|
||||
|
||||
remainingSurfaceTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
|
||||
remainingUncloakTime = (int)(Rules.General.SubmergeDelay * 60 * 25);
|
||||
}
|
||||
|
||||
public IEnumerable<Tuple<Sprite, float2, int>>
|
||||
ModifyRender(Actor self, IEnumerable<Tuple<Sprite, float2, int>> rs)
|
||||
{
|
||||
if (remainingSurfaceTime > 0)
|
||||
if (remainingUncloakTime > 0)
|
||||
return rs;
|
||||
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
@@ -32,19 +32,19 @@ namespace OpenRa.Game.Traits
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (remainingSurfaceTime > 0)
|
||||
if (--remainingSurfaceTime <= 0)
|
||||
OnDive();
|
||||
if (remainingUncloakTime > 0)
|
||||
if (--remainingUncloakTime <= 0)
|
||||
OnUncloak();
|
||||
}
|
||||
|
||||
void OnSurface()
|
||||
void OnCloak()
|
||||
{
|
||||
Sound.Play("subshow1.aud");
|
||||
Sound.Play("ironcur9.aud");
|
||||
}
|
||||
|
||||
void OnDive()
|
||||
void OnUncloak()
|
||||
{
|
||||
Sound.Play("subshow1.aud"); /* is this the right sound?? */
|
||||
Sound.Play("ironcur9.aud"); /* is this the right sound?? */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenRa.Game.GameRules;
|
||||
using OpenRa.Game.Graphics;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRa.Game.Traits
|
||||
{
|
||||
@@ -23,4 +24,9 @@ namespace OpenRa.Game.Traits
|
||||
ModifyRender( Actor self, IEnumerable<Tuple<Sprite, float2, int>> r ); }
|
||||
interface IDamageModifier { float GetDamageModifier(); }
|
||||
interface ISpeedModifier { float GetSpeedModifier(); }
|
||||
interface IPips {
|
||||
Color GetBorderColor();
|
||||
int GetPipCount();
|
||||
Color GetColorForPip(int index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace OpenRa.Game
|
||||
case "StartProduction":
|
||||
case "PauseProduction":
|
||||
case "CancelProduction":
|
||||
case "ActivatePortableChronoshift":
|
||||
case "UsePortableChronoshift":
|
||||
{
|
||||
foreach( var t in order.Subject.traits.WithInterface<IOrder>() )
|
||||
t.ResolveOrder( order.Subject, order );
|
||||
|
||||
Reference in New Issue
Block a user