From b6229fd4569a5f505c664a1c6186e562e051ce34 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 12 Oct 2015 01:09:34 +0200 Subject: [PATCH 1/5] Implement D2k thumper --- mods/d2k/rules/infantry.yaml | 40 +++++++++++++++++++++----------- mods/d2k/rules/structures.yaml | 3 --- mods/d2k/sequences/infantry.yaml | 9 +++++-- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/mods/d2k/rules/infantry.yaml b/mods/d2k/rules/infantry.yaml index 150ba32b31..07e68141f5 100644 --- a/mods/d2k/rules/infantry.yaml +++ b/mods/d2k/rules/infantry.yaml @@ -74,34 +74,48 @@ trooper: WithInfantryBody: AttackSequence: shoot -medic: +thumper: Inherits: ^Infantry + -AutoTarget: Buildable: Queue: Infantry BuildPaletteOrder: 60 - Prerequisites: ~barracks.medics, upgrade.barracks, ~techlevel.high + Prerequisites: upgrade.barracks, ~techlevel.high Valued: Cost: 200 CustomBuildTimeValue: Value: 108 Tooltip: - Name: Medic - Description: Heals nearby infantry\n Strong vs Nothing\n Weak vs Everything + Name: Thumper + Description: Attracts nearby worms\n Unarmed Health: HP: 375 RevealsShroud: Range: 2c768 Mobile: - Speed: 42 - Armament: - Weapon: Heal - Cursor: ability - OutsideRangeCursor: ability - TargetStances: Ally - ForceTargetStances: None - AttackFrontal: + Speed: 43 + DeployToUpgrade: + Upgrades: deployed + Facing: 128 + AllowedTerrainTypes: Sand, Spice, Dune WithInfantryBody: - AttackSequence: heal + UpgradeTypes: deployed + UpgradeMaxEnabledLevel: 0 + WithSpriteBody@DEPLOYED: + Sequence: thump + UpgradeTypes: deployed + UpgradeMinEnabledLevel: 1 + WithIdleOverlay@DEPLOYED: + Sequence: thump-sand + UpgradeTypes: deployed + UpgradeMinEnabledLevel: 1 + AttractsWorms: + Intensity: 1000 + UpgradeTypes: deployed + UpgradeMinEnabledLevel: 1 + DisableOnUpgrade: + UpgradeTypes: deployed + UpgradeMinEnabledLevel: 1 Passenger: PipType: Blue Voiced: diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index cab05e7141..e4d159d9cb 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -168,9 +168,6 @@ barracks: ProvidesPrerequisite@harkonnen: Prerequisite: barracks.harkonnen Factions: harkonnen - ProvidesPrerequisite@medics: - Prerequisite: barracks.medics - Factions: atreides, ordos Power: Amount: -30 RenderSprites: diff --git a/mods/d2k/sequences/infantry.yaml b/mods/d2k/sequences/infantry.yaml index e0f59cdbc3..746d6bc618 100644 --- a/mods/d2k/sequences/infantry.yaml +++ b/mods/d2k/sequences/infantry.yaml @@ -170,7 +170,7 @@ engineer: Start: 4013 Offset: -30,-24 -medic: # actually thumper +thumper: stand: DATA.R8 Start: 1402 Facings: -8 @@ -196,10 +196,15 @@ medic: # actually thumper Facings: -8 Transpose: true Tick: 120 - heal: DATA.R8 + thump: DATA.R8 Start: 1458 Length: 5 Tick: 480 + thump-sand: DATA.R8 + Start: 3626 + Length: 5 + Tick: 480 + BlendMode: Multiply die1: DATA.R8 Frames: 1543, 1550, 1557, 1564, 1571, 1578, 1585, 1592, 1599, 1600, 1601, 1602 Length: 12 From bbf5a4a06d3b940763ff8b4a1aa53a530190e5de Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 26 Oct 2015 17:29:07 +0100 Subject: [PATCH 2/5] Make AmbientSound upgradable and add customisable interval --- .../Traits/Sound/AmbientSound.cs | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs index 9b1ca95441..4236692e10 100644 --- a/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs +++ b/OpenRA.Mods.Common/Traits/Sound/AmbientSound.cs @@ -13,22 +13,61 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Plays a looping audio file at the actor position. Attach this to the `World` actor to cover the whole map.")] - class AmbientSoundInfo : ITraitInfo + class AmbientSoundInfo : UpgradableTraitInfo { [FieldLoader.Require] public readonly string SoundFile = null; - public object Create(ActorInitializer init) { return new AmbientSound(init.Self, this); } + [Desc("Interval between playing the sound (in ticks).")] + public readonly int Interval = 0; + + public override object Create(ActorInitializer init) { return new AmbientSound(init.Self, this); } } - class AmbientSound + class AmbientSound : UpgradableTrait, ITick { + ISound currentSound; + bool wasDisabled = true; + int interval; + public AmbientSound(Actor self, AmbientSoundInfo info) + : base(info) { + interval = info.Interval; + } + + public void Tick(Actor self) + { + if (IsTraitDisabled) + { + Game.Sound.StopSound(currentSound); + currentSound = null; + wasDisabled = true; + return; + } + + if (wasDisabled && Info.Interval <= 0) + { + if (self.OccupiesSpace != null) + currentSound = Game.Sound.PlayLooped(Info.SoundFile, self.CenterPosition); + else + currentSound = Game.Sound.PlayLooped(Info.SoundFile); + } + + wasDisabled = false; + + if (Info.Interval <= 0) + return; + + if (interval-- > 0) + return; + + interval = Info.Interval; + if (self.OccupiesSpace != null) - Game.Sound.PlayLooped(info.SoundFile, self.CenterPosition); + Game.Sound.Play(Info.SoundFile, self.CenterPosition); else - Game.Sound.PlayLooped(info.SoundFile); + Game.Sound.Play(Info.SoundFile); } } } From dbaf7e9d122eebc989098e7846da95401a55a069 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 26 Oct 2015 17:29:19 +0100 Subject: [PATCH 3/5] Add D2k thumper sound --- mods/d2k/rules/infantry.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/d2k/rules/infantry.yaml b/mods/d2k/rules/infantry.yaml index 07e68141f5..4ecee1381c 100644 --- a/mods/d2k/rules/infantry.yaml +++ b/mods/d2k/rules/infantry.yaml @@ -109,6 +109,11 @@ thumper: Sequence: thump-sand UpgradeTypes: deployed UpgradeMinEnabledLevel: 1 + AmbientSound: + SoundFile: THUMPER1.WAV + Interval: 60 + UpgradeTypes: deployed + UpgradeMinEnabledLevel: 1 AttractsWorms: Intensity: 1000 UpgradeTypes: deployed From f220a18fef548be86e2f3c1a4665267a1e8ec436 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Mon, 26 Oct 2015 17:35:19 +0100 Subject: [PATCH 4/5] Align thumper-sand overlay with thump anim --- mods/d2k/sequences/infantry.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/d2k/sequences/infantry.yaml b/mods/d2k/sequences/infantry.yaml index 746d6bc618..1f114d484d 100644 --- a/mods/d2k/sequences/infantry.yaml +++ b/mods/d2k/sequences/infantry.yaml @@ -201,7 +201,7 @@ thumper: Length: 5 Tick: 480 thump-sand: DATA.R8 - Start: 3626 + Frames: 3629, 3630, 3626, 3627, 3628 Length: 5 Tick: 480 BlendMode: Multiply From 2e0a8ef9c470bd73d1a3028aa9f42bb6c9bbcb02 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 30 Oct 2015 14:26:23 +0100 Subject: [PATCH 5/5] Make sandworms not eat infantry --- OpenRA.Mods.D2k/Traits/Sandworm.cs | 3 ++- mods/d2k/weapons.yaml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.D2k/Traits/Sandworm.cs b/OpenRA.Mods.D2k/Traits/Sandworm.cs index b525e58239..2ee042dc1f 100644 --- a/OpenRA.Mods.D2k/Traits/Sandworm.cs +++ b/OpenRA.Mods.D2k/Traits/Sandworm.cs @@ -99,7 +99,8 @@ namespace OpenRA.Mods.D2k.Traits targetCountdown = Info.TargetRescanInterval; // If close enough, we don't care about other actors. - var target = self.World.FindActorsInCircle(self.CenterPosition, Info.IgnoreNoiseAttackRange).FirstOrDefault(x => x.Info.HasTraitInfo()); + var target = self.World.FindActorsInCircle(self.CenterPosition, Info.IgnoreNoiseAttackRange) + .FirstOrDefault(x => attackTrait.HasAnyValidWeapons(Target.FromActor(x))); if (target != null) { self.CancelActivity(); diff --git a/mods/d2k/weapons.yaml b/mods/d2k/weapons.yaml index 3d13dd3b67..f1fc599a27 100644 --- a/mods/d2k/weapons.yaml +++ b/mods/d2k/weapons.yaml @@ -563,10 +563,10 @@ Heal: WormJaw: ReloadDelay: 10 - InvalidTargets: Structure + InvalidTargets: Structure, Infantry Range: 1c512 Warhead@1Dam: SpreadDamage - InvalidTargets: Structure + InvalidTargets: Structure, Infantry Spread: 768 Falloff: 100, 100, 0 Damage: 10000