diff --git a/OpenRa.Game/Effects/LaserZap.cs b/OpenRa.Game/Effects/LaserZap.cs new file mode 100644 index 0000000000..f32ebbe109 --- /dev/null +++ b/OpenRa.Game/Effects/LaserZap.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OpenRa.Graphics; +using OpenRa.Traits; +using System.Drawing; + +namespace OpenRa.Effects +{ + class LaserZap : IEffect + { + readonly int2 from, to; + readonly int radius; + int timeUntilRemove = 10; // # of frames + int totalTime = 10; + Color color; + + public LaserZap(int2 from, int2 to, int radius, Color color) + { + this.from = from; + this.to = to; + this.color = color; + this.radius = radius; + } + + public void Tick(World world) + { + if (timeUntilRemove <= 0) + world.AddFrameEndTask(w => w.Remove(this)); + --timeUntilRemove; + } + + public IEnumerable Render() + { + int alpha = (int)((1-(float)(totalTime-timeUntilRemove)/totalTime)*255); + Color rc = Color.FromArgb(alpha,color); + + for (int i = -radius; i < radius; i++) + Game.world.WorldRenderer.lineRenderer.DrawLine(from + new int2(i, 0), to + new int2(i, 0), rc, rc); + + yield break; + } + } +} diff --git a/OpenRa.Game/GameRules/WeaponInfo.cs b/OpenRa.Game/GameRules/WeaponInfo.cs index e76ce3c4ea..6664939b2c 100755 --- a/OpenRa.Game/GameRules/WeaponInfo.cs +++ b/OpenRa.Game/GameRules/WeaponInfo.cs @@ -18,5 +18,8 @@ namespace OpenRa.GameRules public readonly string Warhead = null; public readonly bool RenderAsTesla = false; + public readonly bool RenderAsLaser = false; + public readonly bool UsePlayerColor = true; + public readonly int BeamRadius = 1; } } diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index fae4b8e99e..10506cf73a 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -80,6 +80,7 @@ + diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs index fd8960a893..ac9ca0631b 100644 --- a/OpenRa.Game/Traits/AttackBase.cs +++ b/OpenRa.Game/Traits/AttackBase.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using IjwFramework.Types; using OpenRa.Effects; +using System.Drawing; namespace OpenRa.Traits { @@ -148,7 +149,13 @@ namespace OpenRa.Traits { var srcAltitude = unit != null ? unit.Altitude : 0; var destAltitude = destUnit != null ? destUnit.Altitude : 0; - + + if ( weapon.RenderAsLaser ) + { + // TODO: This is a hack; should probably use a particular palette index + Color bc = (weapon.UsePlayerColor) ? Player.PlayerColors[self.Owner.PaletteIndex].c : Color.Red; + self.World.Add(new LaserZap(firePos, thisTarget.CenterLocation.ToInt2(), weapon.BeamRadius, bc)); + } if( weapon.RenderAsTesla ) self.World.Add( new TeslaZap( firePos, thisTarget.CenterLocation.ToInt2() ) ); diff --git a/OpenRa.Game/Traits/RenderBuildingCharge.cs b/OpenRa.Game/Traits/RenderBuildingCharge.cs index 01efb73cca..d8c743cc24 100644 --- a/OpenRa.Game/Traits/RenderBuildingCharge.cs +++ b/OpenRa.Game/Traits/RenderBuildingCharge.cs @@ -3,6 +3,7 @@ namespace OpenRa.Traits { class RenderBuildingChargeInfo : RenderBuildingInfo { + public readonly string ChargeAudio = "tslachg2.aud"; public override object Create(Actor self) { return new RenderBuildingCharge(self); } } @@ -16,7 +17,7 @@ namespace OpenRa.Traits public void Attacking(Actor self) { - Sound.Play("tslachg2.aud"); + Sound.Play(self.Info.Traits.Get().ChargeAudio); anim.PlayThen(GetPrefix(self) + "active", () => anim.PlayRepeating(GetPrefix(self) + "idle")); } diff --git a/mods/cnc/sequences-structures.xml b/mods/cnc/sequences-structures.xml index 786caf8dbe..03ae10d619 100644 --- a/mods/cnc/sequences-structures.xml +++ b/mods/cnc/sequences-structures.xml @@ -132,4 +132,14 @@ + + + + + + + + + + diff --git a/mods/cnc/structures.yaml b/mods/cnc/structures.yaml index dee96cbcc5..0c9d813bb0 100644 --- a/mods/cnc/structures.yaml +++ b/mods/cnc/structures.yaml @@ -323,3 +323,31 @@ TMPL: Armor: light Crewed: yes Sight: 4 + +OBLI: + RequiresPower: + Inherits: ^Building + Buildable: + Icon:obliicnh + TechLevel: 4 + Prerequisites: hq + Owner: soviet + Cost: 1500 + Description: Obelisk of Light + LongDesc: Advanced base defense. Requires power\nto operate.\n Strong vs Tanks, Infantry\n Weak vs Aircraft + Building: + Power: -150 + Footprint: _ x + Dimensions: 1,2 + HP: 200 + Armor: light + Crewed: no + Sight: 5 + Turreted: + RenderBuildingCharge: + ChargeAudio: obelpowr.aud + AttackTurreted: + PrimaryWeapon: Laser + FireDelay: 8 + AutoTarget: + -RenderBuilding: diff --git a/mods/cnc/weapons.ini b/mods/cnc/weapons.ini index c9e098a581..c7a01f860b 100644 --- a/mods/cnc/weapons.ini +++ b/mods/cnc/weapons.ini @@ -1,6 +1,7 @@ [WeaponTypes] MachineGun +Laser ; NOTE: WEAPON PROPERTIES ARE NOT EXPOSED BY TIBED; THESE ARE ALL MADE UP [MachineGun] @@ -13,6 +14,18 @@ Warhead=SA Report=GUN13 Anim=MINIGUN +[Laser] +Damage=100 +ROF=120 +Range=8.5 +Projectile=Invisible +Speed=100 +Warhead=Super +Report=obelray1 +Charges=yes +RenderAsLaser=true +BeamRadius=2 +UsePlayerColor=true [ProjectileTypes] @@ -25,9 +38,15 @@ Image=none [WarheadTypes] SA +Super [SA] Spread=3 Verses=100%,50%,60%,25%,25% Explosion=2 -InfDeath=1 \ No newline at end of file +InfDeath=1 + +[Super] +Spread=1 +Verses=100%,100%,100%,100%,100% +InfDeath=5