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 ) )
|
||||
if (!Game.CanPlaceBuilding(Building, xy, null, true))
|
||||
{
|
||||
Sound.Play("nodeply1.aud");
|
||||
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 );
|
||||
|
||||
@@ -7,19 +7,29 @@ QTNK
|
||||
|
||||
[STNK]
|
||||
Description=Stealth Tank
|
||||
Traits=Unit, Mobile, RenderUnit
|
||||
Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted, Cloak
|
||||
Recoil=2
|
||||
Voice=VehicleVoice
|
||||
|
||||
[TTNK]
|
||||
Description=Tesla Tank
|
||||
Traits=Unit, Mobile, AttackBase, RenderUnitSpinner
|
||||
Voice=VehicleVoice
|
||||
|
||||
[CTNK]
|
||||
Description=Chrono Tank
|
||||
Traits=Unit, Mobile, RenderUnit
|
||||
Traits=Unit, Mobile, AttackBase, RenderUnit, ChronoshiftDeploy
|
||||
Voice=VehicleVoice
|
||||
|
||||
[DTRK]
|
||||
Description=Demo Truck
|
||||
Traits=Unit, Mobile, RenderUnit
|
||||
Traits=Unit, Mobile, AttackBase, RenderUnit
|
||||
Voice=VehicleVoice
|
||||
|
||||
[QTNK]
|
||||
Description=M.A.D. Tank
|
||||
Traits=Unit, Mobile, RenderUnit
|
||||
Voice=VehicleVoice
|
||||
|
||||
|
||||
|
||||
@@ -32,8 +42,8 @@ MSUB
|
||||
Description=Missile Submarine
|
||||
WaterBound=yes
|
||||
BuiltAt=spen
|
||||
Traits=Unit, Mobile, RenderUnit
|
||||
|
||||
Traits=Unit, Mobile, AttackBase, RenderUnit, Submarine
|
||||
FireDelay=2
|
||||
|
||||
|
||||
|
||||
@@ -46,12 +56,13 @@ MECH
|
||||
Description=Tesla Trooper
|
||||
Traits=Unit, Mobile, AttackBase, RenderInfantry
|
||||
SquadSize=1
|
||||
Voice=ShokVoice
|
||||
|
||||
[MECH]
|
||||
Description=Mechanic
|
||||
Traits=Unit, Mobile, AttackBase, RenderInfantry
|
||||
SquadSize=1
|
||||
|
||||
Voice=MechVoice
|
||||
|
||||
|
||||
|
||||
@@ -60,6 +71,9 @@ SquadSize=1
|
||||
PortaTesla
|
||||
TTankZap
|
||||
GoodWrench
|
||||
APTusk
|
||||
Democharge
|
||||
SubSCUD
|
||||
|
||||
[PortaTesla]
|
||||
RenderAsTesla=true
|
||||
@@ -78,3 +92,16 @@ Mechanical
|
||||
|
||||
[Mechanical]
|
||||
|
||||
[VoiceTypes]
|
||||
ShokVoice
|
||||
MechVoice
|
||||
|
||||
[ShokVoice]
|
||||
Select=jchrge1,jjuice1,jjump1,jpower1
|
||||
Move=jdance1,jyes1
|
||||
Attack=jburn,jcrisp1,jshock1,jlight1
|
||||
|
||||
[MechVoice]
|
||||
Select=mhowdy1,mhotdig1,mhuh1
|
||||
Move=mlaff1,mhotdig1,mhear1,mboss1,myeehaw1
|
||||
Attack=mwrench1,mrise1,mboss1,myeehaw1
|
||||
@@ -3,6 +3,22 @@
|
||||
<!-- aftermath units -->
|
||||
<unit name="qtnk">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
<sequence name="charge-0" start="32" length="3" />
|
||||
sequence name="deploy-0" start="35" length="5" />
|
||||
<sequence name="charge-1" start="40" length="3" />
|
||||
<sequence name="deploy-1" start="43" length="5" />
|
||||
<sequence name="charge-2" start="48" length="3" />
|
||||
<sequence name="deploy-2" start="51" length="5" />
|
||||
<sequence name="charge-3" start="56" length="3" />
|
||||
<sequence name="deploy-3" start="59" length="5" />
|
||||
<sequence name="charge-4" start="64" length="3" />
|
||||
<sequence name="deploy-4" start="67" length="5" />
|
||||
<sequence name="charge-5" start="72" length="3" />
|
||||
<sequence name="deploy-5" start="75" length="5" />
|
||||
<sequence name="charge-6" start="80" length="3" />
|
||||
<sequence name="deploy-6" start="83" length="5" />
|
||||
<sequence name="charge-7" start="88" length="3" />
|
||||
<sequence name="deploy-7" start="91" length="5" />
|
||||
</unit>
|
||||
<unit name="ctnk">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
@@ -16,6 +32,12 @@
|
||||
<unit name="ttnk">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
<sequence name="spinner" start="32" length="32" />
|
||||
</unit>
|
||||
<unit name="stnk">
|
||||
<sequence name="idle" start="0" length="32" />
|
||||
<sequence name="load-0" start="32" length="3" />
|
||||
<sequence name="load-1" start="35" length="3" />
|
||||
<sequence name="turret" start="38" length="32" />
|
||||
</unit>
|
||||
<unit name="shok">
|
||||
<sequence name="stand" start="0" length="8" />
|
||||
@@ -67,4 +89,15 @@
|
||||
<sequence name="die4" start="440" length="12" />
|
||||
<sequence name="die5" start="452" length="18" />
|
||||
</unit>
|
||||
<unit name="mech">
|
||||
<sequence name="stand" start="0" length="8" />
|
||||
<sequence name="run-0" start="8" length="6" />
|
||||
<sequence name="run-1" start="14" length="6" />
|
||||
<sequence name="run-2" start="20" length="6" />
|
||||
<sequence name="run-3" start="26" length="6" />
|
||||
<sequence name="run-4" start="32" length="6" />
|
||||
<sequence name="run-5" start="38" length="6" />
|
||||
<sequence name="run-6" start="44" length="6" />
|
||||
<sequence name="run-7" start="50" length="6" />
|
||||
</unit>
|
||||
</sequences>
|
||||
|
||||
@@ -106,7 +106,7 @@ PT
|
||||
Description=Submarine
|
||||
WaterBound=yes
|
||||
BuiltAt=spen
|
||||
Traits=Unit, Mobile, RenderUnit, Cloak, AttackBase
|
||||
Traits=Unit, Mobile, RenderUnit, Submarine, AttackBase
|
||||
FireDelay=2
|
||||
LongDesc=Submerged anti-ship unit armed with \ntorpedoes.\n Strong vs Ships\n Weak vs Everything\n Special Ability: Submerge
|
||||
[DD]
|
||||
|
||||
Reference in New Issue
Block a user