add FallsToEarth for helicopters dying
This commit is contained in:
@@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public class AircraftInfo : ITraitInfo
|
public class AircraftInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int CruiseAltitude = 20;
|
public readonly int CruiseAltitude = 30;
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
public readonly string[] RepairBuildings = { "fix" };
|
public readonly string[] RepairBuildings = { "fix" };
|
||||||
[ActorReference]
|
[ActorReference]
|
||||||
|
|||||||
57
OpenRA.Mods.RA/FallsToEarth.cs
Normal file
57
OpenRA.Mods.RA/FallsToEarth.cs
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#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 OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.RA
|
||||||
|
{
|
||||||
|
class FallsToEarthInfo : TraitInfo<FallsToEarth> { }
|
||||||
|
|
||||||
|
class FallsToEarth : INotifyDamage
|
||||||
|
{
|
||||||
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
|
{
|
||||||
|
if (self.IsDead())
|
||||||
|
{
|
||||||
|
self.Trait<Health>().RemoveOnDeath = false;
|
||||||
|
|
||||||
|
self.CancelActivity();
|
||||||
|
self.QueueActivity(new FallToEarth());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FallToEarth : CancelableActivity
|
||||||
|
{
|
||||||
|
int acceleration = 0;
|
||||||
|
int spin = 0;
|
||||||
|
|
||||||
|
public override IActivity Tick(Actor self)
|
||||||
|
{
|
||||||
|
if (acceleration == 0)
|
||||||
|
acceleration = self.World.SharedRandom.Next(2) * 2 - 1;
|
||||||
|
|
||||||
|
var aircraft = self.Trait<Aircraft>();
|
||||||
|
if (aircraft.Altitude <= 0)
|
||||||
|
{
|
||||||
|
self.Destroy();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
spin += acceleration;
|
||||||
|
aircraft.Facing = (aircraft.Facing + spin) % 256;
|
||||||
|
aircraft.Altitude--;
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnCancel() { return false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProductVersion>9.0.21022</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<ProjectGuid>{4A8A43B5-A9EF-4ED0-99DD-4BAB10A0DB6E}</ProjectGuid>
|
<ProjectGuid>{4A8A43B5-A9EF-4ED0-99DD-4BAB10A0DB6E}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
@@ -91,6 +91,7 @@
|
|||||||
<Compile Include="Effects\RepairIndicator.cs" />
|
<Compile Include="Effects\RepairIndicator.cs" />
|
||||||
<Compile Include="Effects\Smoke.cs" />
|
<Compile Include="Effects\Smoke.cs" />
|
||||||
<Compile Include="Effects\TeslaZap.cs" />
|
<Compile Include="Effects\TeslaZap.cs" />
|
||||||
|
<Compile Include="FallsToEarth.cs" />
|
||||||
<Compile Include="LimitedAmmo.cs" />
|
<Compile Include="LimitedAmmo.cs" />
|
||||||
<Compile Include="MPStartLocations.cs" />
|
<Compile Include="MPStartLocations.cs" />
|
||||||
<Compile Include="Orders\DeployOrderTargeter.cs" />
|
<Compile Include="Orders\DeployOrderTargeter.cs" />
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.Effects;
|
using OpenRA.Effects;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Mods.RA.Orders;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.Traits.Activities;
|
using OpenRA.Traits.Activities;
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using OpenRA.Mods.RA.Orders;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
base.Tick(self);
|
base.Tick(self);
|
||||||
|
|
||||||
var isFlying = self.Trait<IMove>().Altitude > 0;
|
var isFlying = self.Trait<IMove>().Altitude > 0 && !self.IsDead();
|
||||||
if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor"))
|
if (isFlying ^ (rotorAnim.CurrentSequence.Name != "rotor"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -770,6 +770,7 @@ TRAN:
|
|||||||
Types: Infantry
|
Types: Infantry
|
||||||
Passengers: 5
|
Passengers: 5
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
|
FallsToEarth:
|
||||||
|
|
||||||
HELI:
|
HELI:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -807,6 +808,7 @@ HELI:
|
|||||||
LimitedAmmo:
|
LimitedAmmo:
|
||||||
Ammo: 6
|
Ammo: 6
|
||||||
IronCurtainable:
|
IronCurtainable:
|
||||||
|
FallsToEarth:
|
||||||
|
|
||||||
HIND:
|
HIND:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
@@ -847,6 +849,7 @@ HIND:
|
|||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 38,32,0,0
|
Bounds: 38,32,0,0
|
||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
|
FallsToEarth:
|
||||||
|
|
||||||
U2:
|
U2:
|
||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
|
|||||||
Reference in New Issue
Block a user