Capturable husks for cnc
This commit is contained in:
@@ -21,7 +21,8 @@ namespace OpenRA.Mods.RA.Activities
|
||||
public readonly string ToActor = null;
|
||||
public int2 Offset = new int2(0,0);
|
||||
public int Facing = 96;
|
||||
public string[] Sounds = {};
|
||||
public string[] Sounds = {};
|
||||
public int ForceHealthPercentage = 0;
|
||||
|
||||
public Transform(Actor self, string toActor)
|
||||
{
|
||||
@@ -47,10 +48,14 @@ namespace OpenRA.Mods.RA.Activities
|
||||
new FacingInit( Facing ),
|
||||
};
|
||||
var health = self.TraitOrDefault<Health>();
|
||||
// TODO: fix potential desync from HPFraction
|
||||
if (health != null)
|
||||
init.Add( new HealthInit( health.HPFraction ));
|
||||
|
||||
{
|
||||
// TODO: Fix bogus health init
|
||||
if (ForceHealthPercentage > 0)
|
||||
init.Add( new HealthInit( ForceHealthPercentage * 1f / 100 ));
|
||||
else
|
||||
init.Add( new HealthInit( health.HPFraction ));
|
||||
}
|
||||
var a = w.CreateActor( ToActor, init );
|
||||
|
||||
if (selected)
|
||||
|
||||
@@ -337,6 +337,7 @@
|
||||
<Compile Include="Render\WithShadow.cs" />
|
||||
<Compile Include="AnnounceOnBuild.cs" />
|
||||
<Compile Include="Capturable.cs" />
|
||||
<Compile Include="TransformOnCapture.cs" />
|
||||
<Compile Include="Activities\MakeAnimation.cs" />
|
||||
<Compile Include="Activities\Sell.cs" />
|
||||
<Compile Include="Sellable.cs" />
|
||||
|
||||
41
OpenRA.Mods.RA/TransformOnCapture.cs
Normal file
41
OpenRA.Mods.RA/TransformOnCapture.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 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 COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Orders;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class TransformOnCaptureInfo : ITraitInfo
|
||||
{
|
||||
[ActorReference]
|
||||
public readonly string IntoActor = null;
|
||||
public readonly int ForceHealthPercentage = 0;
|
||||
public virtual object Create(ActorInitializer init) { return new TransformOnCapture(this); }
|
||||
}
|
||||
|
||||
class TransformOnCapture : INotifyCapture
|
||||
{
|
||||
TransformOnCaptureInfo Info;
|
||||
|
||||
public TransformOnCapture(TransformOnCaptureInfo info)
|
||||
{
|
||||
Info = info;
|
||||
}
|
||||
|
||||
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||
{
|
||||
self.QueueActivity(new Transform(self, Info.IntoActor) {ForceHealthPercentage = Info.ForceHealthPercentage, Facing = self.Trait<IFacing>().Facing});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,6 +313,14 @@
|
||||
HiddenUnderFog:
|
||||
AppearsOnRadar:
|
||||
Burns:
|
||||
TargetableUnit:
|
||||
TransformOnCapture:
|
||||
ForceHealthPercentage: 25
|
||||
Capturable:
|
||||
Type: husk
|
||||
AllowAllies: true
|
||||
AllowNeutral: true
|
||||
AllowEnemies: true
|
||||
|
||||
^Bridge:
|
||||
Tooltip:
|
||||
|
||||
@@ -145,6 +145,7 @@ E6:
|
||||
PipType: Yellow
|
||||
EngineerRepair:
|
||||
Captures:
|
||||
CaptureTypes: building, husk
|
||||
-AutoTarget:
|
||||
AttackMove:
|
||||
JustMove: true
|
||||
|
||||
@@ -675,6 +675,8 @@ LTNK.Husk:
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
TransformOnCapture:
|
||||
IntoActor: ltnk
|
||||
|
||||
MTNK.Husk:
|
||||
Inherits: ^Husk
|
||||
@@ -688,6 +690,8 @@ MTNK.Husk:
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
TransformOnCapture:
|
||||
IntoActor: mtnk
|
||||
|
||||
HTNK.Husk:
|
||||
Inherits: ^Husk
|
||||
@@ -701,6 +705,8 @@ HTNK.Husk:
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
TransformOnCapture:
|
||||
IntoActor: htnk
|
||||
|
||||
MSAM.Husk:
|
||||
Inherits: ^Husk
|
||||
@@ -714,6 +720,8 @@ MSAM.Husk:
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
TransformOnCapture:
|
||||
IntoActor: msam
|
||||
|
||||
MLRS.Husk:
|
||||
Inherits: ^Husk
|
||||
@@ -727,3 +735,5 @@ MLRS.Husk:
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
TransformOnCapture:
|
||||
IntoActor: mlrs
|
||||
|
||||
Reference in New Issue
Block a user