Improved visuals, added WormSign norification
This commit is contained in:
@@ -13,9 +13,8 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.D2k
|
namespace OpenRA.Mods.D2k
|
||||||
{
|
{
|
||||||
// TODO: This is a copy of AttackLeap. Maybe combine them in AttackMelee trait when the code is finalized?
|
|
||||||
[Desc("Sandworms use this attack model.")]
|
[Desc("Sandworms use this attack model.")]
|
||||||
class AttackSwallowInfo : AttackFrontalInfo, Requires<SandwormInfo>
|
class AttackSwallowInfo : AttackFrontalInfo
|
||||||
{
|
{
|
||||||
[Desc("The number of ticks it takes to return underground.")]
|
[Desc("The number of ticks it takes to return underground.")]
|
||||||
public int ReturnTime = 60;
|
public int ReturnTime = 60;
|
||||||
|
|||||||
@@ -69,10 +69,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AttackSwallow.cs" />
|
<Compile Include="AttackSwallow.cs" />
|
||||||
<Compile Include="Sandworm.cs" />
|
|
||||||
<Compile Include="SwallowActor.cs" />
|
<Compile Include="SwallowActor.cs" />
|
||||||
<Compile Include="ThrowsShrapnel.cs" />
|
|
||||||
<Compile Include="DamagedWithoutFoundation.cs" />
|
|
||||||
<Compile Include="SpriteLoaders\R8Loader.cs" />
|
<Compile Include="SpriteLoaders\R8Loader.cs" />
|
||||||
<Compile Include="Traits\Buildings\DamagedWithoutFoundation.cs" />
|
<Compile Include="Traits\Buildings\DamagedWithoutFoundation.cs" />
|
||||||
<Compile Include="Traits\Render\WithBuildingPlacedOverlay.cs" />
|
<Compile Include="Traits\Render\WithBuildingPlacedOverlay.cs" />
|
||||||
@@ -94,11 +91,6 @@
|
|||||||
<Compile Include="AutoCarryall\AutoCarryall.cs" />
|
<Compile Include="AutoCarryall\AutoCarryall.cs" />
|
||||||
<Compile Include="AutoCarryall\Carryable.cs" />
|
<Compile Include="AutoCarryall\Carryable.cs" />
|
||||||
<Compile Include="AutoCarryall\CarryUnit.cs" />
|
<Compile Include="AutoCarryall\CarryUnit.cs" />
|
||||||
<Compile Include="World\ChooseBuildTabOnSelect.cs" />
|
|
||||||
<Compile Include="World\PaletteFromR8.cs" />
|
|
||||||
<Compile Include="World\FogPaletteFromR8.cs" />
|
|
||||||
<Compile Include="World\D2kResourceLayer.cs" />
|
|
||||||
<Compile Include="World\PaletteFromScaledPalette.cs" />
|
|
||||||
<Compile Include="WormManager.cs" />
|
<Compile Include="WormManager.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
#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;
|
|
||||||
using OpenRA.Mods.RA.Move;
|
|
||||||
using OpenRA.Mods.RA.Render;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA.Mods.D2k
|
|
||||||
{
|
|
||||||
class SandwormInfo : Requires<RenderUnitInfo>, Requires<MobileInfo>, IOccupySpaceInfo
|
|
||||||
{
|
|
||||||
readonly public string WormSignNotification = "WormSign";
|
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Sandworm(this); }
|
|
||||||
}
|
|
||||||
|
|
||||||
class Sandworm
|
|
||||||
{
|
|
||||||
public Sandworm(SandwormInfo info)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,27 +17,30 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.D2k
|
namespace OpenRA.Mods.D2k
|
||||||
{
|
{
|
||||||
public enum AttackState { Burrowed, EmergingAboveGround, ReturningUnderground }
|
enum AttackState { Burrowed, EmergingAboveGround, ReturningUnderground }
|
||||||
|
|
||||||
class SwallowActor : Activity
|
class SwallowActor : Activity
|
||||||
{
|
{
|
||||||
readonly Target target;
|
readonly Target target;
|
||||||
readonly Sandworm sandworm;
|
|
||||||
readonly WeaponInfo weapon;
|
readonly WeaponInfo weapon;
|
||||||
|
readonly RenderUnit renderUnit;
|
||||||
readonly AttackSwallow swallow;
|
readonly AttackSwallow swallow;
|
||||||
readonly IPositionable positionable;
|
readonly IPositionable positionable;
|
||||||
|
|
||||||
int countdown;
|
int countdown;
|
||||||
AttackState stance = AttackState.Burrowed;
|
AttackState stance;
|
||||||
|
|
||||||
public SwallowActor(Actor self, Target target, WeaponInfo weapon)
|
public SwallowActor(Actor self, Target target, WeaponInfo weapon)
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.weapon = weapon;
|
this.weapon = weapon;
|
||||||
positionable = self.TraitOrDefault<Mobile>();
|
positionable = self.TraitOrDefault<Mobile>();
|
||||||
sandworm = self.TraitOrDefault<Sandworm>();
|
|
||||||
swallow = self.TraitOrDefault<AttackSwallow>();
|
swallow = self.TraitOrDefault<AttackSwallow>();
|
||||||
|
renderUnit = self.TraitOrDefault<RenderUnit>();
|
||||||
countdown = swallow.AttackSwallowInfo.AttackTime;
|
countdown = swallow.AttackSwallowInfo.AttackTime;
|
||||||
|
|
||||||
|
renderUnit.DefaultAnimation.ReplaceAnim("burrowed");
|
||||||
|
stance = AttackState.Burrowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WormAttack(Actor worm)
|
bool WormAttack(Actor worm)
|
||||||
@@ -45,7 +48,7 @@ namespace OpenRA.Mods.D2k
|
|||||||
var targetLocation = target.Actor.Location;
|
var targetLocation = target.Actor.Location;
|
||||||
|
|
||||||
var lunch = worm.World.ActorMap.GetUnitsAt(targetLocation)
|
var lunch = worm.World.ActorMap.GetUnitsAt(targetLocation)
|
||||||
.Where(t => !t.Equals(worm) && weapon.IsValidAgainst(t, worm));
|
.Where(t => !t.Equals(worm) && weapon.IsValidAgainst(t, worm));
|
||||||
if (!lunch.Any())
|
if (!lunch.Any())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -61,7 +64,6 @@ namespace OpenRA.Mods.D2k
|
|||||||
|
|
||||||
void PlayAttackAnimation(Actor self)
|
void PlayAttackAnimation(Actor self)
|
||||||
{
|
{
|
||||||
var renderUnit = self.Trait<RenderUnit>();
|
|
||||||
renderUnit.PlayCustomAnim(self, "sand");
|
renderUnit.PlayCustomAnim(self, "sand");
|
||||||
renderUnit.PlayCustomAnim(self, "mouth");
|
renderUnit.PlayCustomAnim(self, "mouth");
|
||||||
}
|
}
|
||||||
@@ -74,28 +76,27 @@ namespace OpenRA.Mods.D2k
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stance == AttackState.ReturningUnderground) // Wait for the worm to get back underground
|
if (stance == AttackState.ReturningUnderground) // Wait for the worm to get back underground
|
||||||
{
|
{
|
||||||
if (self.World.SharedRandom.Next() % 2 == 0) // There is a 50-50 chance that the worm would just go away
|
if (self.World.SharedRandom.Next()%2 == 0) // There is a 50-50 chance that the worm would just go away
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.World.AddFrameEndTask(w => w.Remove(self));
|
self.World.AddFrameEndTask(w => w.Remove(self));
|
||||||
var wormManager = self.World.WorldActor.TraitOrDefault<WormManager>();
|
var wormManager = self.World.WorldActor.TraitOrDefault<WormManager>();
|
||||||
if (wormManager != null)
|
if (wormManager != null)
|
||||||
wormManager.DecreaseWorms();
|
wormManager.DecreaseWorms();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
renderUnit.DefaultAnimation.ReplaceAnim("idle");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: If the worm did not disappear, make the animation reappear here
|
|
||||||
|
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stance == AttackState.Burrowed) // Wait for the worm to get in position
|
if (stance == AttackState.Burrowed) // Wait for the worm to get in position
|
||||||
{
|
{
|
||||||
// TODO: Make the worm animation (currenty the lightning) disappear here
|
|
||||||
|
|
||||||
// This is so that the worm cancels an attack against a target that has reached solid rock
|
// This is so that the worm cancels an attack against a target that has reached solid rock
|
||||||
if (sandworm == null || positionable == null || !positionable.CanEnterCell(target.Actor.Location, null, false))
|
if (positionable == null || !positionable.CanEnterCell(target.Actor.Location, null, false))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
var success = WormAttack(self);
|
var success = WormAttack(self);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ namespace OpenRA.Mods.D2k
|
|||||||
[Desc("Average time (seconds) between worm spawn")]
|
[Desc("Average time (seconds) between worm spawn")]
|
||||||
public readonly int SpawnInterval = 180;
|
public readonly int SpawnInterval = 180;
|
||||||
|
|
||||||
|
public readonly string WormSignNotification = "WormSign";
|
||||||
|
|
||||||
public readonly string WormSignature = "sandworm";
|
public readonly string WormSignature = "sandworm";
|
||||||
public readonly string WormOwnerPlayer = "Creeps";
|
public readonly string WormOwnerPlayer = "Creeps";
|
||||||
|
|
||||||
@@ -71,6 +73,8 @@ namespace OpenRA.Mods.D2k
|
|||||||
new LocationInit(spawnLocation)
|
new LocationInit(spawnLocation)
|
||||||
}));
|
}));
|
||||||
wormsPresent++;
|
wormsPresent++;
|
||||||
|
|
||||||
|
AnnounceWormSign(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPos GetRandomSpawnPosition(Actor self)
|
CPos GetRandomSpawnPosition(Actor self)
|
||||||
@@ -82,6 +86,12 @@ namespace OpenRA.Mods.D2k
|
|||||||
{
|
{
|
||||||
wormsPresent--;
|
wormsPresent--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AnnounceWormSign(Actor self)
|
||||||
|
{
|
||||||
|
if (self.World.LocalPlayer != null)
|
||||||
|
Sound.PlayNotification(self.World.Map.Rules, self.World.LocalPlayer, "Speech", info.WormSignNotification, self.World.LocalPlayer.Country.Race);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("An actor with this trait indicates a valid spawn point for sandworms.")]
|
[Desc("An actor with this trait indicates a valid spawn point for sandworms.")]
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
|||||||
"This conflicts with player orders and should only be added to animal creeps.")]
|
"This conflicts with player orders and should only be added to animal creeps.")]
|
||||||
class AttackWanderInfo : ITraitInfo
|
class AttackWanderInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
readonly public int WanderMoveRadius = 10;
|
public readonly int WanderMoveRadius = 10;
|
||||||
|
|
||||||
[Desc("Number of ticks to wait until decreasing the effective move radius.")]
|
[Desc("Number of ticks to wait until decreasing the effective move radius.")]
|
||||||
public readonly int MoveReductionRadiusScale = 5;
|
public readonly int MoveReductionRadiusScale = 5;
|
||||||
|
|||||||
@@ -458,6 +458,7 @@ VICE:
|
|||||||
MuzzleSplitFacings: 8
|
MuzzleSplitFacings: 8
|
||||||
AttackFrontal:
|
AttackFrontal:
|
||||||
AttackWander:
|
AttackWander:
|
||||||
|
WanderMoveRadius: 4
|
||||||
RenderUnit:
|
RenderUnit:
|
||||||
WithMuzzleFlash:
|
WithMuzzleFlash:
|
||||||
SplitFacings: true
|
SplitFacings: true
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ SANDWORM:
|
|||||||
RenderUnit:
|
RenderUnit:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
HiddenUnderFog:
|
HiddenUnderFog:
|
||||||
Sandworm:
|
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
UseLocation: yes
|
UseLocation: yes
|
||||||
AttackSwallow:
|
AttackSwallow:
|
||||||
|
|||||||
@@ -456,5 +456,7 @@ sandworm:
|
|||||||
Length: 35
|
Length: 35
|
||||||
Tick: 180
|
Tick: 180
|
||||||
BlendMode: Additive
|
BlendMode: Additive
|
||||||
|
burrowed: DATA
|
||||||
|
Start: 39
|
||||||
icon: wormicon
|
icon: wormicon
|
||||||
Start: 0
|
Start: 0
|
||||||
@@ -583,6 +583,7 @@ DOGGIE:
|
|||||||
Weapon: FiendShard
|
Weapon: FiendShard
|
||||||
AttackFrontal:
|
AttackFrontal:
|
||||||
AttackWander:
|
AttackWander:
|
||||||
|
WanderMoveRadius: 4
|
||||||
|
|
||||||
VISSML:
|
VISSML:
|
||||||
Inherits: ^Infantry
|
Inherits: ^Infantry
|
||||||
|
|||||||
Reference in New Issue
Block a user