Skip to content

Commit

Permalink
Merge remote-tracking branch 'darkademic/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Inq8 committed Nov 23, 2023
2 parents ade7784 + 8e4561d commit 89c3d02
Show file tree
Hide file tree
Showing 162 changed files with 13,183 additions and 139 deletions.
26 changes: 25 additions & 1 deletion OpenRA.Mods.CA/Activities/SpawnActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#endregion

using System.Linq;
using System.Collections.Generic;
using OpenRA.Activities;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Traits;
Expand All @@ -27,8 +28,12 @@ public class SpawnActor : Activity
readonly AmmoPool ammoPool;
readonly int range;
readonly bool avoidActors;
readonly WDist maxRange;
readonly bool spawnInShroud;
readonly HashSet<string> allowedTerrainTypes;

public SpawnActor(Actor self, CPos targetCell, WPos targetPos, string type, bool skipMakeAnims, string[] spawnSounds, AmmoPool ammoPool, int range, bool avoidActors)
public SpawnActor(Actor self, CPos targetCell, WPos targetPos, string type, bool skipMakeAnims, string[] spawnSounds,
AmmoPool ammoPool, int range, bool avoidActors, WDist maxRange, bool spawnInShroud, HashSet<string> allowedTerrainTypes)
{
this.targetPos = targetPos;
this.targetCell = targetCell;
Expand All @@ -38,6 +43,9 @@ public SpawnActor(Actor self, CPos targetCell, WPos targetPos, string type, bool
this.ammoPool = ammoPool;
this.range = range;
this.avoidActors = avoidActors;
this.maxRange = maxRange;
this.spawnInShroud = spawnInShroud;
this.allowedTerrainTypes = allowedTerrainTypes;
}

public override bool Tick(Actor self)
Expand Down Expand Up @@ -73,6 +81,9 @@ void Spawn(Actor self)
{
while (cell.MoveNext() && !placed)
{
if (!IsValidTargetCell(cell.Current, self))
continue;
var actorsInCell = self.World.ActorMap.GetActorsAt(cell.Current);
if (actorsInCell.Any())
Expand All @@ -98,6 +109,9 @@ void Spawn(Actor self)
&& ai.TraitInfo<AircraftInfo>().CanEnterCell(self.World, unit, cell.Current, SubCell.FullCell, null, BlockedByActor.None))
subCell = SubCell.FullCell;
if (!IsValidTargetCell(cell.Current, self))
continue;
if (subCell != SubCell.Invalid)
{
positionable.SetPosition(unit, cell.Current, subCell);
Expand Down Expand Up @@ -128,6 +142,16 @@ void Spawn(Actor self)
});
}

bool IsValidTargetCell(CPos cell, Actor self)
{
var targetPos = self.World.Map.CenterOfCell(cell);
var sourcePos = self.CenterPosition;

return ((targetPos - sourcePos).Length <= maxRange.Length
&& (spawnInShroud || self.Owner.Shroud.IsExplored(cell))
&& (allowedTerrainTypes.Count == 0 || allowedTerrainTypes.Contains(self.World.Map.GetTerrainInfo(cell).Type)));
}

TypeDictionary CreateTypeDictionary(Actor self, CPos targetCell)
{
var td = new TypeDictionary
Expand Down
8 changes: 6 additions & 2 deletions OpenRA.Mods.CA/Traits/SpawnActorAbility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public class SpawnActorAbilityInfo : PausableConditionalTraitInfo, Requires<IMov
[Desc("If true allow targeting in shroud.")]
public readonly bool CanTargetShroud = true;

[Desc("List of valid terrain types to spawn at. Leave blank for any.")]
public readonly HashSet<string> AllowedTerrainTypes = new();

[Desc("Play a randomly selected sound from this list when spawning the actor.")]
public readonly string[] SpawnSounds = Array.Empty<string>();

Expand Down Expand Up @@ -161,7 +164,7 @@ void IResolveOrder.ResolveOrder(Actor self, Order order)
if (Info.Range > WDist.Zero)
self.QueueActivity(move.MoveWithinRange(order.Target, Info.Range, targetLineColor: Info.TargetLineColor));

self.QueueActivity(new SpawnActor(self, cell, order.Target.CenterPosition, Info.Actor, Info.SkipMakeAnimations, Info.SpawnSounds, ammoPool, 3, true));
self.QueueActivity(new SpawnActor(self, cell, order.Target.CenterPosition, Info.Actor, Info.SkipMakeAnimations, Info.SpawnSounds, ammoPool, 3, true, Info.Range, Info.CanTargetShroud, Info.AllowedTerrainTypes));
self.ShowTargetLines();
}
}
Expand Down Expand Up @@ -252,7 +255,8 @@ protected override string GetCursor(World world, CPos cell, int2 worldPixel, Mou
{
if (self.IsInWorld && self.Location != cell
&& ability.CanSpawnActor
&& (info.CanTargetShroud || self.Owner.Shroud.IsExplored(cell)))
&& (info.CanTargetShroud || self.Owner.Shroud.IsExplored(cell))
&& (info.AllowedTerrainTypes.Count == 0 || info.AllowedTerrainTypes.Contains(world.Map.GetTerrainInfo(cell).Type)))
return info.TargetCursor;
else
return info.TargetBlockedCursor;
Expand Down
15 changes: 15 additions & 0 deletions OpenRA.Mods.CA/Warheads/FireShrapnelWarhead.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
#endregion

using System;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.Common;
Expand Down Expand Up @@ -44,6 +45,9 @@ public class FireShrapnelWarhead : WarheadAS, IRulesetLoaded<WeaponInfo>
[Desc("Does this weapon aim at the target's center regardless of other targetable offsets?")]
public readonly bool TargetActorCenter = false;

[Desc("List of sounds that can be played on impact.")]
public readonly string[] ImpactSounds = Array.Empty<string>();

WeaponInfo weapon;

public void RulesetLoaded(Ruleset rules, WeaponInfo info)
Expand Down Expand Up @@ -108,6 +112,8 @@ public override void DoImpact(in Target target, WarheadArgs args)
? world.SharedRandom.Next(Amount[0], Amount[1])
: Amount[0];

var targetFound = false;

for (var i = 0; i < amount; i++)
{
var shrapnelTarget = Target.Invalid;
Expand All @@ -128,6 +134,8 @@ public override void DoImpact(in Target target, WarheadArgs args)
if (shrapnelTarget.Type == TargetType.Invalid)
continue;

targetFound = true;

var shrapnelFacing = (shrapnelTarget.CenterPosition - epicenter).Yaw;

// Lambdas can't use 'in' variables, so capture a copy for later
Expand Down Expand Up @@ -165,6 +173,13 @@ public override void DoImpact(in Target target, WarheadArgs args)
Game.Sound.Play(SoundType.World, projectileArgs.Weapon.Report.Random(firedBy.World.SharedRandom), target.CenterPosition);
}
}

if (targetFound)
{
var impactSound = ImpactSounds.RandomOrDefault(world.LocalRandom);
if (impactSound != null)
Game.Sound.Play(SoundType.World, impactSound, target.CenterPosition);
}
}
}
}
3 changes: 3 additions & 0 deletions mods/ca/audio/music.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,6 @@ recon: Recon (CA Remix)
moi2: March on Instinct 2
Extension: mp3
VolumeModifier: 0.9
gateway: Gateway
Extension: mp3
VolumeModifier: 0.7
Binary file modified mods/ca/bits/audio/n_flare1.aud
Binary file not shown.
Binary file modified mods/ca/bits/audio/n_frenzyrdy1.aud
Binary file not shown.
Binary file modified mods/ca/bits/audio/n_load1.aud
Binary file not shown.
Binary file added mods/ca/bits/audio/purification.aud
Binary file not shown.
Binary file modified mods/ca/bits/gpsdot.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/tbcl.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/alien.pal
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora1.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora10.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora11.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora12.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora13.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora14.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora2.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora3.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora4.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora5.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora6.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora7.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora8.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/terrain/scrinflora9.shp
Binary file not shown.
Binary file added mods/ca/bits/temp/cave01.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave02.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave03.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave04.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave05.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave06.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave07.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave08.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave09.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave10.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave11.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave12.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave13.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave14.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave15.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave16.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave17.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave18.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave19.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave20.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave21.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave22.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave23.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave24.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave25.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave26.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave27.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave28.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave29.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave30.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave31.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave32.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave33.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave34.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave35.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave36.tem
Binary file not shown.
Binary file added mods/ca/bits/temp/cave37.tem
Binary file not shown.
1 change: 1 addition & 0 deletions mods/ca/installer/downloads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,4 @@ camusic: CA Music
^SupportDir|Content/ca/music/subvn.mp3: subvn.mp3
^SupportDir|Content/ca/music/recon.mp3: recon.mp3
^SupportDir|Content/ca/music/moi2.mp3: moi2.mp3
^SupportDir|Content/ca/music/gateway.mp3: gateway.mp3
2 changes: 1 addition & 1 deletion mods/ca/maps/ca-prologue-02/ca-prologue-02.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ end
-- Functions

InitGreece = function()
AutoRepairBuildings(Greece, 10)
AutoRepairBuildings(Greece)
SetupRefAndSilosCaptureCredits(Greece)
AutoReplaceHarvesters(Greece)

Expand Down
7 changes: 4 additions & 3 deletions mods/ca/maps/ca-prologue-03/ca-prologue-03.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ WorldLoaded = function()
}

Trigger.OnEnteredProximityTrigger(Reveal2.CenterPosition, WDist.New(11 * 1024), function(a, id)
if a.Owner == MissionPlayer and a.Type ~= cameraType then
if a.Owner == MissionPlayer and a.Type ~= cameraType and not FirstRevealComplete then
Trigger.RemoveProximityTrigger(id)
FirstRevealComplete = true
local camera = Actor.Create("smallcamera", true, { Owner = GDI, Location = Reveal2.Location })

if UtilsCA.FogEnabled() then
Expand Down Expand Up @@ -155,7 +156,7 @@ end
-- Functions

InitUSSR = function()
AutoRepairBuildings(USSR, 10)
AutoRepairBuildings(USSR)

local ussrGroundAttackers = USSR.GetGroundAttackers()

Expand All @@ -177,7 +178,7 @@ DistGuns = function()
local distGunSounds = { "distguns1.aud", "distguns2.aud", "distguns3.aud" }
local cameraPos = Camera.Position
local posModifier = WVec.New(Utils.Random({ -5120, 3072, 5120 }), 0, 0)
MediaCA.PlaySoundAtPos(Utils.Random(distGunSounds), "1", cameraPos + posModifier)
MediaCA.PlaySoundAtPos(Utils.Random(distGunSounds), 1, cameraPos + posModifier)
DistGuns()
end
end)
Expand Down
2 changes: 1 addition & 1 deletion mods/ca/maps/ca-prologue-04/ca-prologue-04.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ end
-- Functions

InitGDI = function()
AutoRepairBuildings(GDI, 10)
AutoRepairBuildings(GDI)
SetupRefAndSilosCaptureCredits(GDI)
AutoReplaceHarvesters(GDI)

Expand Down
3 changes: 1 addition & 2 deletions mods/ca/maps/ca10-awakening/ca10.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ OncePerSecondChecks = function()
TemplePrime.GrantCondition("awakening-complete")
end

MediaCA.PlaySound("n_cyborgscomplete.aud", 2)
DeployCyborgs()

if ObjectiveDestroyBases ~= nil then
Expand Down Expand Up @@ -371,8 +372,6 @@ DoHaloDrop = function()
end

DeployCyborgs = function()
MediaCA.PlaySound("n_cyborgscomplete.aud", 2)

if CyborgWaves == 0 then
CyborgFactory1.RallyPoint = CyborgRally1.Location
CyborgFactory2.RallyPoint = CyborgRally2.Location
Expand Down
4 changes: 4 additions & 0 deletions mods/ca/maps/ca22-capitulation/ca22.lua
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ WorldLoaded = function()
MediaCA.PlaySound("suspicious.aud", 2)
Spy.Move(SouthDelivery3.Location)
SpyKiller.Attack(Spy)
Trigger.AfterDelay(AdjustTimeForGameSpeed(DateTime.Seconds(10)), function()
Media.DisplayMessage("Attention you capitalist dogs! My defenses are impenetrable. Leave at once, or prepare to be crushed!", "Stalin", HSLColor.FromHex("DD0000"))
MediaCA.PlaySound("stalin_warning.aud", 2)
end)
end)
end

Expand Down
Binary file added mods/ca/maps/ca22-capitulation/stalin_warning.aud
Binary file not shown.
6 changes: 4 additions & 2 deletions mods/ca/maps/ca25-singularity/ca25.lua
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ end
OncePerSecondChecks = function()
if DateTime.GameTime > 1 and DateTime.GameTime % 25 == 0 then
Scrin.Resources = Scrin.ResourceCapacity - 500
SignalTransmitterPlayer.Resources = SignalTransmitterPlayer.ResourceCapacity - 500
NodSlaves.Resources = NodSlaves.ResourceCapacity - 500
AlliedSlaves.Resources = AlliedSlaves.ResourceCapacity - 500
SovietSlaves.Resources = SovietSlaves.ResourceCapacity - 500
Expand Down Expand Up @@ -500,6 +501,7 @@ OncePerFiveSecondChecks = function()
return
end

MediaCA.PlaySound("seth_morehackers.aud", 2)
Media.DisplayMessage("We are sending you another squad of hackers. Perhaps you'll be more careful with them this time.", "Nod Commander", HSLColor.FromHex("FF0000"))
DropHackers()
end)
Expand Down Expand Up @@ -644,8 +646,8 @@ end
DropHackers = function()
Beacon.New(GDI, HackerDropLanding.CenterPosition)

Notification("Nod Hackers en route. Use them to hack into the Scrin Signal Transmitter. They claim to be able to bring the Mothership's shields down.")
MediaCA.PlaySound("c_hackers.aud", 2)
MediaCA.PlaySound("seth_hackers.aud", 2)
Media.DisplayMessage("Attention GDI commander. We are sending you some of our hackers. Use them to hack into the Scrin Signal Transmitter. They will be able to bring the Mothership's shields down for you.", "Nod Commander", HSLColor.FromHex("FF0000"))

local hackerFlare = Actor.Create("flare", true, { Owner = GDI, Location = HackerDropLanding.Location })
Trigger.AfterDelay(DateTime.Seconds(10), function()
Expand Down
Binary file added mods/ca/maps/ca25-singularity/seth_hackers.aud
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added mods/ca/maps/ca26-foothold/c_tiblifeforms.aud
Binary file not shown.
Loading

0 comments on commit 89c3d02

Please sign in to comment.