husk experiment
This commit is contained in:
@@ -18,9 +18,10 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace OpenRA.FileFormats
|
||||
{
|
||||
public enum TerrainType : byte
|
||||
|
||||
@@ -23,7 +23,7 @@ using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
class RenderUnitInfo : RenderSimpleInfo
|
||||
public class RenderUnitInfo : RenderSimpleInfo
|
||||
{
|
||||
public override object Create(Actor self) { return new RenderUnit(self); }
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
class UnitInfo : OwnedActorInfo, ITraitInfo
|
||||
public class UnitInfo : OwnedActorInfo, ITraitInfo
|
||||
{
|
||||
public readonly int InitialFacing = 128;
|
||||
public readonly int ROT = 255;
|
||||
|
||||
42
OpenRA.Mods.RA/LeavesHusk.cs
Normal file
42
OpenRA.Mods.RA/LeavesHusk.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
*
|
||||
* OpenRA is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OpenRA is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class LeavesHuskInfo : TraitInfo<LeavesHusk> { public readonly string HuskActor = null; }
|
||||
|
||||
class LeavesHusk : INotifyDamage
|
||||
{
|
||||
public void Damaged(Actor self, AttackInfo e)
|
||||
{
|
||||
if (e.DamageState == DamageState.Dead)
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
var info = self.Info.Traits.Get<LeavesHuskInfo>();
|
||||
var husk = w.CreateActor(info.HuskActor, self.Location, self.Owner);
|
||||
husk.CenterLocation = self.CenterLocation;
|
||||
husk.traits.Get<Unit>().Altitude = self.traits.Get<Unit>().Altitude;
|
||||
husk.traits.Get<Unit>().Facing = self.traits.Get<Unit>().Facing;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@
|
||||
<Compile Include="Effects\NukeLaunch.cs" />
|
||||
<Compile Include="Activities\Harvest.cs" />
|
||||
<Compile Include="Harvester.cs" />
|
||||
<Compile Include="LeavesHusk.cs" />
|
||||
<Compile Include="OreRefinery.cs" />
|
||||
<Compile Include="ChronoshiftPaletteEffect.cs" />
|
||||
<Compile Include="ChronoshiftPower.cs" />
|
||||
@@ -94,6 +95,7 @@
|
||||
<Compile Include="TeslaInstantKills.cs" />
|
||||
<Compile Include="Thief.cs" />
|
||||
<Compile Include="Crates\ResetRadarCrateAction.cs" />
|
||||
<Compile Include="ThrowsParticles.cs" />
|
||||
<Compile Include="TraitsInterfaces.cs" />
|
||||
<Compile Include="DefaultShellmapScript.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
76
OpenRA.Mods.RA/ThrowsParticles.cs
Normal file
76
OpenRA.Mods.RA/ThrowsParticles.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
*
|
||||
* OpenRA is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OpenRA is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class ThrowsParticleInfo : ITraitInfo
|
||||
{
|
||||
public readonly string Anim = null;
|
||||
public readonly int[] Offset = new[] { 0, 0, 0, 0 };
|
||||
public readonly int[] Spread = new[] { 0, 0 };
|
||||
public readonly float Speed = 20;
|
||||
public readonly string AnimKey = null;
|
||||
public object Create(Actor self) { return new ThrowsParticle(self, this); }
|
||||
}
|
||||
|
||||
class ThrowsParticle : ITick
|
||||
{
|
||||
ThrowsParticleInfo info;
|
||||
float2 pos;
|
||||
float alt;
|
||||
|
||||
float2 v;
|
||||
float va;
|
||||
|
||||
const float gravity = 1.3f;
|
||||
|
||||
public ThrowsParticle(Actor self, ThrowsParticleInfo info) { this.info = info; }
|
||||
|
||||
public void Tick(Actor self)
|
||||
{
|
||||
if (info != null)
|
||||
{
|
||||
alt = 0;
|
||||
pos = Util.GetTurretPosition(self, self.traits.Get<Unit>(), info.Offset, 0);
|
||||
var ru = self.traits.Get<RenderUnit>();
|
||||
|
||||
v = Game.CosmeticRandom.Gauss2D(1) * info.Spread.RelOffset();
|
||||
va = info.Speed;
|
||||
|
||||
var anim = new Animation(ru.GetImage(self), () => self.traits.Get<Unit>().Facing);
|
||||
anim.PlayRepeating(info.Anim);
|
||||
|
||||
ru.anims.Add(info.AnimKey, new RenderSimple.AnimationWithOffset(
|
||||
anim, () => pos - new float2(0, alt), null));
|
||||
|
||||
info = null;
|
||||
}
|
||||
|
||||
pos += v;
|
||||
v = .9f * v;
|
||||
va -= gravity;
|
||||
alt += va;
|
||||
if (alt < 0) alt = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
Player:
|
||||
ProductionQueue:
|
||||
BuildSpeed: .4
|
||||
BuildSpeed: .04
|
||||
LowPowerSlowdown: 3
|
||||
PlaceBuilding:
|
||||
GpsPower:
|
||||
|
||||
@@ -82,6 +82,8 @@ V2RL:
|
||||
Recoil: 2
|
||||
RenderUnitTurreted:
|
||||
AutoTarget:
|
||||
LeavesHusk:
|
||||
HuskActor: 1TNK.Husk
|
||||
|
||||
2TNK:
|
||||
Inherits: ^Vehicle
|
||||
@@ -107,6 +109,8 @@ V2RL:
|
||||
Recoil: 3
|
||||
RenderUnitTurreted:
|
||||
AutoTarget:
|
||||
LeavesHusk:
|
||||
HuskActor: 2TNK.Husk
|
||||
|
||||
3TNK:
|
||||
Inherits: ^Vehicle
|
||||
@@ -132,6 +136,8 @@ V2RL:
|
||||
Recoil: 3
|
||||
RenderUnitTurreted:
|
||||
AutoTarget:
|
||||
LeavesHusk:
|
||||
HuskActor: 3TNK.Husk
|
||||
|
||||
4TNK:
|
||||
Inherits: ^Vehicle
|
||||
@@ -160,6 +166,8 @@ V2RL:
|
||||
Recoil: 4
|
||||
RenderUnitTurreted:
|
||||
AutoTarget:
|
||||
LeavesHusk:
|
||||
HuskActor: 4TNK.Husk
|
||||
|
||||
ARTY:
|
||||
Inherits: ^Vehicle
|
||||
@@ -645,3 +653,75 @@ U2:
|
||||
WithShadow:
|
||||
IronCurtainable:
|
||||
-Selectable:
|
||||
|
||||
1TNK.Husk:
|
||||
Inherits: ^Vehicle
|
||||
Valued:
|
||||
Description: Husk (Light Tank)
|
||||
Unit:
|
||||
HP: 80
|
||||
Armor: heavy
|
||||
ROT: 0
|
||||
RenderUnit:
|
||||
Image: 1tnk
|
||||
Selectable:
|
||||
Priority: -1
|
||||
ThrowsParticle@turret:
|
||||
Anim: turret
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
|
||||
2TNK.Husk:
|
||||
Inherits: ^Vehicle
|
||||
Valued:
|
||||
Description: Husk (Medium Tank)
|
||||
Unit:
|
||||
HP: 80
|
||||
Armor: heavy
|
||||
ROT: 0
|
||||
RenderUnit:
|
||||
Image: 2tnk
|
||||
Selectable:
|
||||
Priority: -1
|
||||
ThrowsParticle@turret:
|
||||
Anim: turret
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
|
||||
3TNK.Husk:
|
||||
Inherits: ^Vehicle
|
||||
Valued:
|
||||
Description: Husk (Heavy Tank)
|
||||
Unit:
|
||||
HP: 80
|
||||
Armor: heavy
|
||||
ROT: 0
|
||||
RenderUnit:
|
||||
Image: 3tnk
|
||||
Selectable:
|
||||
Priority: -1
|
||||
ThrowsParticle@turret:
|
||||
Anim: turret
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
|
||||
4TNK.Husk:
|
||||
Inherits: ^Vehicle
|
||||
Valued:
|
||||
Description: Husk (Mammoth Tank)
|
||||
Unit:
|
||||
HP: 80
|
||||
Armor: heavy
|
||||
ROT: 0
|
||||
RenderUnit:
|
||||
Image: 4tnk
|
||||
Selectable:
|
||||
Priority: -1
|
||||
ThrowsParticle@turret:
|
||||
Anim: turret
|
||||
Spread: 3,3
|
||||
Speed: 6
|
||||
AnimKey: turret
|
||||
Reference in New Issue
Block a user