Merge pull request #4803 from reaperrr/obelisk-fix2
Building charge improvements
This commit is contained in:
@@ -76,6 +76,7 @@ NEW:
|
||||
Decreased Visceroid health by 25% and removed their ability to gain experience.
|
||||
Increased the chance of Tiberium or chemical deaths spawning a Visceroid from 2% to 10%.
|
||||
Increased Obelisk of Light laser damage from 200 to 360.
|
||||
Fixed Obelisk of Light charge animation and sound not playing.
|
||||
Engine:
|
||||
Converted Aircraft CruiseAltitude to world coordinates.
|
||||
Converted Health Radius to world coordinates.
|
||||
@@ -95,6 +96,8 @@ NEW:
|
||||
Fixed performance issues with units pathing to naval transports.
|
||||
Fixed unit moving to transports that have moved.
|
||||
Updated shroud-based traits to use world units.
|
||||
Renamed AttackTesla into AttackCharge and un-hardcoded initial charge delay and delay for additional charges.
|
||||
Updated RenderBuildingCharge so you can set a custom charge sequence name (default is active).
|
||||
Server:
|
||||
Message of the day is now shared between all mods and a default motd.txt gets created in the user directory.
|
||||
Asset Browser:
|
||||
|
||||
118
OpenRA.Mods.RA/Attack/AttackCharge.cs
Normal file
118
OpenRA.Mods.RA/Attack/AttackCharge.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 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 OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class AttackChargeInfo : AttackOmniInfo
|
||||
{
|
||||
public readonly int MaxCharges = 1;
|
||||
[Desc("Reload time (for all charges).")]
|
||||
public readonly int ReloadTime = 120;
|
||||
[Desc("Delay for first charge. Needs to match FireDelay for Obelisk.")]
|
||||
public readonly int InitialChargeDelay = 22;
|
||||
[Desc("Delay for additional charges if MaxCharge is larger than 1.")]
|
||||
public readonly int ChargeDelay = 3;
|
||||
public override object Create(ActorInitializer init) { return new AttackCharge(init.self); }
|
||||
}
|
||||
|
||||
class AttackCharge : AttackOmni, ITick, INotifyAttack, ISync
|
||||
{
|
||||
[Sync] int charges;
|
||||
[Sync] int timeToRecharge;
|
||||
|
||||
public AttackCharge(Actor self)
|
||||
: base(self)
|
||||
{
|
||||
charges = self.Info.Traits.Get<AttackChargeInfo>().MaxCharges;
|
||||
}
|
||||
|
||||
public override void Tick( Actor self )
|
||||
{
|
||||
if( --timeToRecharge <= 0 )
|
||||
charges = self.Info.Traits.Get<AttackChargeInfo>().MaxCharges;
|
||||
|
||||
base.Tick( self );
|
||||
}
|
||||
|
||||
public void Attacking(Actor self, Target target, Armament a, Barrel barrel)
|
||||
{
|
||||
--charges;
|
||||
timeToRecharge = self.Info.Traits.Get<AttackChargeInfo>().ReloadTime;
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove)
|
||||
{
|
||||
return new ChargeAttack(newTarget);
|
||||
}
|
||||
|
||||
|
||||
public override void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
base.ResolveOrder(self, order);
|
||||
|
||||
if (order.OrderString == "Stop")
|
||||
self.CancelActivity();
|
||||
}
|
||||
|
||||
class ChargeAttack : Activity
|
||||
{
|
||||
readonly Target target;
|
||||
public ChargeAttack(Target target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
var initDelay = self.Info.Traits.Get<AttackChargeInfo>().InitialChargeDelay;
|
||||
|
||||
var attack = self.Trait<AttackCharge>();
|
||||
if(attack.charges == 0 || !attack.CanAttack(self, target))
|
||||
return this;
|
||||
|
||||
self.Trait<RenderBuildingCharge>().PlayCharge(self);
|
||||
return Util.SequenceActivities(new Wait(initDelay), new ChargeFire(target), this);
|
||||
}
|
||||
}
|
||||
|
||||
class ChargeFire : Activity
|
||||
{
|
||||
readonly Target target;
|
||||
public ChargeFire(Target target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
var chargeDelay = self.Info.Traits.Get<AttackChargeInfo>().ChargeDelay;
|
||||
|
||||
var attack = self.Trait<AttackCharge>();
|
||||
if(attack.charges == 0)
|
||||
return NextActivity;
|
||||
|
||||
attack.DoAttack(self, target);
|
||||
|
||||
return Util.SequenceActivities(new Wait(chargeDelay), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
#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 OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class AttackTeslaInfo : AttackOmniInfo
|
||||
{
|
||||
public readonly int MaxCharges = 3;
|
||||
public readonly int ReloadTime = 120;
|
||||
public override object Create(ActorInitializer init) { return new AttackTesla(init.self); }
|
||||
}
|
||||
|
||||
class AttackTesla : AttackOmni, ITick, INotifyAttack, ISync
|
||||
{
|
||||
[Sync] int charges;
|
||||
[Sync] int timeToRecharge;
|
||||
|
||||
public AttackTesla( Actor self )
|
||||
: base( self )
|
||||
{
|
||||
charges = self.Info.Traits.Get<AttackTeslaInfo>().MaxCharges;
|
||||
}
|
||||
|
||||
public override void Tick( Actor self )
|
||||
{
|
||||
if( --timeToRecharge <= 0 )
|
||||
charges = self.Info.Traits.Get<AttackTeslaInfo>().MaxCharges;
|
||||
|
||||
base.Tick( self );
|
||||
}
|
||||
|
||||
public void Attacking(Actor self, Target target, Armament a, Barrel barrel)
|
||||
{
|
||||
--charges;
|
||||
timeToRecharge = self.Info.Traits.Get<AttackTeslaInfo>().ReloadTime;
|
||||
}
|
||||
|
||||
public override Activity GetAttackActivity( Actor self, Target newTarget, bool allowMove )
|
||||
{
|
||||
return new TeslaAttack( newTarget );
|
||||
}
|
||||
|
||||
|
||||
public override void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
base.ResolveOrder(self, order);
|
||||
|
||||
if (order.OrderString == "Stop")
|
||||
self.CancelActivity();
|
||||
}
|
||||
|
||||
class TeslaAttack : Activity
|
||||
{
|
||||
readonly Target target;
|
||||
public TeslaAttack( Target target ) { this.target = target; }
|
||||
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
var attack = self.Trait<AttackTesla>();
|
||||
if( attack.charges == 0 || !attack.CanAttack( self, target ) )
|
||||
return this;
|
||||
|
||||
self.Trait<RenderBuildingCharge>().PlayCharge(self);
|
||||
return Util.SequenceActivities( new Wait( 22 ), new TeslaZap( target ), this );
|
||||
}
|
||||
}
|
||||
|
||||
class TeslaZap : Activity
|
||||
{
|
||||
readonly Target target;
|
||||
public TeslaZap( Target target ) { this.target = target; }
|
||||
|
||||
public override Activity Tick( Actor self )
|
||||
{
|
||||
if (IsCanceled || !target.IsValidFor(self))
|
||||
return NextActivity;
|
||||
|
||||
var attack = self.Trait<AttackTesla>();
|
||||
if( attack.charges == 0 ) return NextActivity;
|
||||
|
||||
attack.DoAttack( self, target );
|
||||
|
||||
return Util.SequenceActivities( new Wait( 3 ), this );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@
|
||||
<Compile Include="Attack\AttackMedic.cs" />
|
||||
<Compile Include="Attack\AttackOmni.cs" />
|
||||
<Compile Include="Attack\AttackPopupTurreted.cs" />
|
||||
<Compile Include="Attack\AttackTesla.cs" />
|
||||
<Compile Include="Attack\AttackCharge.cs" />
|
||||
<Compile Include="Attack\AttackTurreted.cs" />
|
||||
<Compile Include="Attack\AttackWander.cs" />
|
||||
<Compile Include="AutoHeal.cs" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 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,
|
||||
@@ -8,15 +8,20 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
public class RenderBuildingChargeInfo : RenderBuildingInfo
|
||||
{
|
||||
public readonly string ChargeAudio = "tslachg2.aud";
|
||||
[Desc("Sound to play when building charges.")]
|
||||
public readonly string ChargeAudio = null;
|
||||
[Desc("Sequence to use for building charge animation.")]
|
||||
public readonly string ChargeSequence = "active";
|
||||
public override object Create(ActorInitializer init) { return new RenderBuildingCharge(init, this); }
|
||||
}
|
||||
|
||||
/* used for tesla */
|
||||
/* used for tesla and obelisk */
|
||||
public class RenderBuildingCharge : RenderBuilding
|
||||
{
|
||||
RenderBuildingChargeInfo info;
|
||||
@@ -30,7 +35,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public void PlayCharge(Actor self)
|
||||
{
|
||||
Sound.Play(info.ChargeAudio, self.CenterPosition);
|
||||
anim.PlayThen(NormalizeSequence(self, "active"),
|
||||
anim.PlayThen(NormalizeSequence(self, info.ChargeSequence),
|
||||
() => anim.PlayRepeating(NormalizeSequence(self, "idle")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,6 +106,19 @@ namespace OpenRA.Utility
|
||||
}
|
||||
}
|
||||
|
||||
// AttackTesla was replaced with AttackCharge
|
||||
if (engineVersion < 20140307)
|
||||
{
|
||||
if (depth == 1 && parentKey == "World")
|
||||
{
|
||||
if (node.Key == "AttackTesla")
|
||||
node.Key = "AttackCharge";
|
||||
|
||||
if (node.Key == "-AttackTesla")
|
||||
node.Key = "-AttackCharge";
|
||||
}
|
||||
}
|
||||
|
||||
// AttackMove was generalized to support all moveable actor types
|
||||
if (engineVersion < 20140116)
|
||||
{
|
||||
|
||||
@@ -600,10 +600,10 @@ OBLI:
|
||||
Armament:
|
||||
Weapon: Laser
|
||||
LocalOffset: 0,0,725
|
||||
FireDelay: 8
|
||||
AttackTesla:
|
||||
MaxCharge: 1
|
||||
FireDelay: 25
|
||||
AttackCharge:
|
||||
ReloadTime: 90
|
||||
InitialChargeDelay: 25
|
||||
AutoTarget:
|
||||
-RenderBuilding:
|
||||
RenderRangeCircle:
|
||||
|
||||
@@ -340,11 +340,11 @@ obli:
|
||||
active:
|
||||
Start: 0
|
||||
Length: 4
|
||||
Tick: 400
|
||||
Tick: 680
|
||||
damaged-active:
|
||||
Start: 4
|
||||
Length: 4
|
||||
Tick: 400
|
||||
Tick: 680
|
||||
dead:
|
||||
Start: 8
|
||||
make: oblimake
|
||||
|
||||
@@ -303,10 +303,12 @@ TSLA:
|
||||
RevealsShroud:
|
||||
Range: 8c0
|
||||
RenderBuildingCharge:
|
||||
ChargeAudio: tslachg2.aud
|
||||
Armament:
|
||||
Weapon: TeslaZap
|
||||
LocalOffset: 0,0,427
|
||||
AttackTesla:
|
||||
AttackCharge:
|
||||
MaxCharges: 3
|
||||
ReloadTime: 120
|
||||
AutoTarget:
|
||||
IronCurtainable:
|
||||
|
||||
Reference in New Issue
Block a user