From 03f014ffb9abe411d568ef3375961288bbd95e45 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 11 Feb 2011 23:05:01 +1300 Subject: [PATCH] Visceroid spawning. Add tib death anims for e1 and e2. Others will crash. --- OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj | 1 + OpenRA.Mods.Cnc/SpawnViceroid.cs | 55 +++++++++++++++++++++ mods/cnc/rules/defaults.yaml | 1 + mods/cnc/rules/infantry.yaml | 5 +- mods/cnc/sequences/infantry.yaml | 67 +++++++++++++++++--------- mods/cnc/weapons.yaml | 4 +- 6 files changed, 106 insertions(+), 27 deletions(-) create mode 100644 OpenRA.Mods.Cnc/SpawnViceroid.cs diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index 7cf3ef9040..333af4cfeb 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -69,6 +69,7 @@ + diff --git a/OpenRA.Mods.Cnc/SpawnViceroid.cs b/OpenRA.Mods.Cnc/SpawnViceroid.cs new file mode 100644 index 0000000000..ce3f12c272 --- /dev/null +++ b/OpenRA.Mods.Cnc/SpawnViceroid.cs @@ -0,0 +1,55 @@ +#region Copyright & License Information +/* + * Copyright 2007-2010 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 LICENSE. + */ +#endregion + +using OpenRA.Traits; +using OpenRA.FileFormats; +using System.Linq; + +namespace OpenRA.Mods.Cnc +{ + class SpawnViceroidInfo : ITraitInfo + { + [ActorReference] + public readonly string ViceroidActor = "vice"; + public readonly int Probability = 10; + public readonly string Owner = "Creeps"; + public readonly int InfDeath = 5; + + public object Create(ActorInitializer init) { return new SpawnViceroid(this); } + } + + class SpawnViceroid : INotifyDamage + { + readonly SpawnViceroidInfo Info; + + public SpawnViceroid(SpawnViceroidInfo info) + { + Info = info; + } + + public void Damaged(Actor self, AttackInfo e) + { + if (e.DamageState == DamageState.Dead && e.Warhead.InfDeath == Info.InfDeath + && self.World.SharedRandom.Next(100) <= Info.Probability) + self.World.AddFrameEndTask(w => + { + var td = new TypeDictionary + { + new LocationInit( self.Location ), + new OwnerInit( self.World.players.Values.First(p => p.InternalName == Info.Owner) ) + }; + + if (self.HasTrait()) + td.Add(new FacingInit( self.Trait().Facing )); + w.CreateActor(Info.ViceroidActor, td); + }); + } + } +} diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 6dc62f6802..78b0d110ae 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -126,6 +126,7 @@ Notification: unitlost.aud ProximityCaptor: Types:Infantry + SpawnViceroid: ^CivInfantry: Inherits: ^Infantry diff --git a/mods/cnc/rules/infantry.yaml b/mods/cnc/rules/infantry.yaml index a11b23cede..fcf4d1c1a9 100644 --- a/mods/cnc/rules/infantry.yaml +++ b/mods/cnc/rules/infantry.yaml @@ -19,7 +19,7 @@ E1: PrimaryWeapon: M16 TakeCover: IdleAnimation: - Animations: idle1,idle2,idle3 + Animations: idle1,idle2,idle3,idle4 E2: Inherits: ^Infantry Valued: @@ -205,4 +205,5 @@ VICE: RenderUnit: WithMuzzleFlash: Armor: - Type: Wood \ No newline at end of file + Type: Wood + -PoisonedByTiberium: \ No newline at end of file diff --git a/mods/cnc/sequences/infantry.yaml b/mods/cnc/sequences/infantry.yaml index 28b7f2cbe7..f0b549a66a 100644 --- a/mods/cnc/sequences/infantry.yaml +++ b/mods/cnc/sequences/infantry.yaml @@ -45,22 +45,35 @@ e1: Start: 289 Length: 22 Tick: 120 + # Dancing + idle4: + Start: 517 + Length: 9 + Tick: 120 + # Shot die1: Start: 381 Length: 9 - die5: - Start: 418 - Length: 18 - die4: - Start: 406 - Length: 12 - die3: - Start: 398 - Length: 8 + # Explode die2: Start: 390 Length: 8 - + # Fly through air and explode + die3: + Start: 398 + Length: 8 + # Fly higher through air and explode + die4: + Start: 406 + Length: 12 + # Burn + die5: + Start: 418 + Length: 18 + # Tib + die6: + Start: 366 + Length: 11 e2: stand: Start: 0 @@ -92,22 +105,30 @@ e2: Start: 400 Length: 13 Tick: 120 - die5: - Start: 546 - Length: 18 - die4: - Start: 534 - Length: 12 - die3: - Start: 526 - Length: 8 - die2: - Start: 518 - Length: 8 + # Shot die1: Start: 509 Length: 9 - + # Explode + die2: + Start: 518 + Length: 8 + # Fly through air + die3: + Start: 526 + Length: 8 + # Fly higher through air + die4: + Start: 534 + Length: 12 + # Burn + die5: + Start: 546 + Length: 18 + # Tib + die6: + Start: 494 + Length: 11 e3: stand: Start: 0 diff --git a/mods/cnc/weapons.yaml b/mods/cnc/weapons.yaml index 62024ce761..92e383e38f 100644 --- a/mods/cnc/weapons.yaml +++ b/mods/cnc/weapons.yaml @@ -286,7 +286,7 @@ Chemspray: Wood: 75% Light: 60% Heavy: 25% - InfDeath: 2 + InfDeath: 5 SmudgeType: Scorch ImpactSound: xplos @@ -676,6 +676,6 @@ Tiberium: ROF: 10 Warhead: Spread: 1 - InfDeath: 4 + InfDeath: 5 Damage: 5 PreventProne: yes \ No newline at end of file