Visible cargo for LST

This commit is contained in:
Paul Chote
2010-08-17 15:25:58 +12:00
parent 142be86934
commit c7e76cc26d
6 changed files with 47 additions and 0 deletions

View File

@@ -61,6 +61,7 @@
<Compile Include="DeadBuildingState.cs" />
<Compile Include="Missions\Gdi01Script.cs" />
<Compile Include="RenderGunboat.cs" />
<Compile Include="RenderCargo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,41 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Collections.Generic;
using OpenRA.Traits;
using OpenRA.Mods.RA;
using System;
using System.Linq;
namespace OpenRA.Mods.Cnc
{
class RenderCargoInfo : ITraitInfo, ITraitPrerequisite<CargoInfo>
{
public object Create(ActorInitializer init) { return new RenderCargo(init.self); }
}
public class RenderCargo : IRenderModifier
{
Cargo cargo;
public RenderCargo(Actor self)
{
cargo = self.Trait<Cargo>();
}
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
{
foreach (var c in cargo.Passengers)
c.CenterLocation = self.CenterLocation;
return r.Concat(cargo.Passengers.SelectMany(a => a.Render()));
}
}
}

View File

@@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA
public class Cargo : IPips, IIssueOrder, IResolveOrder, IOrderCursor, IOrderVoice
{
List<Actor> cargo = new List<Actor>();
public IEnumerable<Actor> Passengers { get { return cargo; } }
public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
{

View File

@@ -447,4 +447,5 @@ Rules:
LocalPlayerFromMap:
-CreateMPPlayers:
-SpawnMPUnits:
-ConquestVictoryConditions:
Gdi01Script:

View File

@@ -106,6 +106,7 @@
<!-- Hovercraft -->
<unit name="lst">
<sequence name="idle" start="0" facings="1" />
<sequence name="unload" start="0" facings="1" />
</unit>
<!-- Gunboat -->
<unit name="boat">

View File

@@ -556,6 +556,8 @@ LST:
RevealsShroud:
Range: 7
RenderUnit:
BelowUnits:
RenderCargo:
Cargo:
Types: Infantry, Vehicle
Passengers: 5