From acf55f1bb070da973e369679dd534b8bc1b4825a Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 6 May 2010 22:15:02 +1200 Subject: [PATCH] hack hack hack... working dog --- OpenRA.Game/Traits/Activities/Leap.cs | 24 +++++++++++++++++++++++- OpenRA.Game/Traits/Attack/AttackBase.cs | 13 ++++++++----- OpenRA.Game/Traits/Attack/AttackLeap.cs | 3 ++- mods/ra/infantry.yaml | 1 + mods/ra/sequences.xml | 2 +- mods/ra/structures.yaml | 4 ++-- mods/ra/weapons.yaml | 7 +------ settings-netplay-ra.ini | 4 +++- 8 files changed, 41 insertions(+), 17 deletions(-) diff --git a/OpenRA.Game/Traits/Activities/Leap.cs b/OpenRA.Game/Traits/Activities/Leap.cs index fdc3b4ecad..d869a47c2a 100644 --- a/OpenRA.Game/Traits/Activities/Leap.cs +++ b/OpenRA.Game/Traits/Activities/Leap.cs @@ -23,8 +23,19 @@ namespace OpenRA.Traits.Activities class Leap : IActivity { Actor target; + float2 initialLocation; + float t; - public Leap(Actor target) { this.target = target; } + const int delay = 6; + + public Leap(Actor self, Actor target) + { + this.target = target; + initialLocation = self.CenterLocation; + + self.traits.Get().Attacking(self); + Sound.Play("dogg5p.aud"); + } public IActivity NextActivity { get; set; } @@ -33,6 +44,17 @@ namespace OpenRA.Traits.Activities if (target == null || !target.IsInWorld) return NextActivity; + t += (1f / delay); + + self.CenterLocation = float2.Lerp(initialLocation, target.CenterLocation, t); + + if (t >= 1f) + { + self.traits.Get().TeleportTo(self, target.Location); + target.InflictDamage(self, target.Health, null); // kill it + return NextActivity; + } + return this; } diff --git a/OpenRA.Game/Traits/Attack/AttackBase.cs b/OpenRA.Game/Traits/Attack/AttackBase.cs index d2d4ed8afb..1570571aba 100755 --- a/OpenRA.Game/Traits/Attack/AttackBase.cs +++ b/OpenRA.Game/Traits/Attack/AttackBase.cs @@ -187,12 +187,15 @@ namespace OpenRA.Traits ScheduleDelayedAction( FireDelay( self, self.Info.Traits.Get() ), () => { - var projectile = args.weapon.Projectile.Create(args); - if (projectile != null) - self.World.Add(projectile); + if (args.weapon.Projectile != null) + { + var projectile = args.weapon.Projectile.Create(args); + if (projectile != null) + self.World.Add(projectile); - if (!string.IsNullOrEmpty(args.weapon.Report)) - Sound.Play(args.weapon.Report + ".aud"); + if (!string.IsNullOrEmpty(args.weapon.Report)) + Sound.Play(args.weapon.Report + ".aud"); + } }); foreach (var na in self.traits.WithInterface()) diff --git a/OpenRA.Game/Traits/Attack/AttackLeap.cs b/OpenRA.Game/Traits/Attack/AttackLeap.cs index 72abcc7b91..aca25545e5 100644 --- a/OpenRA.Game/Traits/Attack/AttackLeap.cs +++ b/OpenRA.Game/Traits/Attack/AttackLeap.cs @@ -37,12 +37,13 @@ namespace OpenRA.Traits base.Tick(self); if (target == null || !target.IsInWorld) return; + if (self.GetCurrentActivity() is Leap) return; var weapon = self.GetPrimaryWeapon(); if (weapon.Range * weapon.Range < (target.Location - self.Location).LengthSquared) return; self.CancelActivity(); - self.QueueActivity(new Leap(target)); + self.QueueActivity(new Leap(self, target)); } } } diff --git a/mods/ra/infantry.yaml b/mods/ra/infantry.yaml index 706c25aa39..5790b2b531 100644 --- a/mods/ra/infantry.yaml +++ b/mods/ra/infantry.yaml @@ -17,6 +17,7 @@ DOG: Speed: 4 AutoTarget: AttackLeap: + PrimaryWeapon: DogJaw E1: Inherits: ^Infantry diff --git a/mods/ra/sequences.xml b/mods/ra/sequences.xml index e20bbbc7e2..36f65aab89 100644 --- a/mods/ra/sequences.xml +++ b/mods/ra/sequences.xml @@ -639,7 +639,7 @@ - + diff --git a/mods/ra/structures.yaml b/mods/ra/structures.yaml index 87e1d333e1..352cc37e64 100644 --- a/mods/ra/structures.yaml +++ b/mods/ra/structures.yaml @@ -849,11 +849,11 @@ BRIK: Description: Concrete Wall LongDesc: Stop units and blocks enemy fire. BuildPaletteOrder: 100 - DamagedSound: crmble2.aud - DestroyedSound: kaboom30.aud Building: HP: 100 Armor: none + DamagedSound: crmble2.aud + DestroyedSound: kaboom30.aud RenderBuildingWall: DamageStates: 4 diff --git a/mods/ra/weapons.yaml b/mods/ra/weapons.yaml index 2e96d2a775..9f3dad87ec 100644 --- a/mods/ra/weapons.yaml +++ b/mods/ra/weapons.yaml @@ -581,13 +581,8 @@ ParaBomb: DogJaw: ROF: 10 - Range: 2.2 + Range: 5 Report: DOGG5P - Missile: - Image: DOGBULLT - Proximity: yes - ROT: 20 - Speed: 20 Warhead: Spread: 5 Verses: 100%,0%,0%,0%,0% diff --git a/settings-netplay-ra.ini b/settings-netplay-ra.ini index be73876bc4..777a9f7118 100644 --- a/settings-netplay-ra.ini +++ b/settings-netplay-ra.ini @@ -1,4 +1,6 @@ [Settings] NetworkHost=localhost NetworkPort=1234 -InitialMods=ra \ No newline at end of file +InitialMods=ra +Width=1024 +Height=768 \ No newline at end of file