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 Feb 14, 2024
2 parents 5ec9708 + 407df87 commit ee778c8
Show file tree
Hide file tree
Showing 41 changed files with 471 additions and 196 deletions.
2 changes: 1 addition & 1 deletion OpenRA.Mods.CA/Projectiles/PlasmaBeam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ public void Tick(World world)
CheckBlocked();
CalculateColors(direction);

if (++ticks >= info.Duration)
if (++ticks >= info.Duration || args.SourceActor.IsDead)
{
world.AddFrameEndTask(w => w.Remove(this));
return;
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.CA/Traits/Attachable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public override bool CanTargetActor(Actor self, Actor target, TargetModifiers mo
if (!attachable.Info.ValidRelationships.HasRelationship(stance))
return false;

if (!attachable.Info.Types.Overlaps(target.GetAllTargetTypes()))
if (!attachable.Info.Types.Overlaps(target.GetEnabledTargetTypes()))
return false;

cursor = target.TraitsImplementing<AttachableTo>().Any(x => x.CanAttach(attachable)) ? attachable.Info.EnterCursor : attachable.Info.BlockedCursor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public class GrantExternalConditionPowerCAInfo : SupportPowerInfo
public readonly string OnFireSound = null;

[Desc("Target types that condition can be applied to. Leave empty for all types.")]
public readonly BitSet<TargetableType> ValidTargets = default(BitSet<TargetableType>);
public readonly BitSet<TargetableType> ValidTargets = default;

[Desc("Target types that condition can be applied to. Leave empty for all types.")]
public readonly BitSet<TargetableType> InvalidTargets = default;

[Desc("Player relationships which condition can be applied to.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;
Expand Down Expand Up @@ -197,7 +200,8 @@ private IEnumerable<Actor> GetTargetsInCircle(CPos xy)
.Where(a => a.IsInWorld
&& !a.IsDead
&& info.ValidRelationships.HasRelationship(Self.Owner.RelationshipWith(a.Owner))
&& (info.ValidTargets.IsEmpty || info.ValidTargets.Overlaps(a.GetAllTargetTypes()))
&& (info.ValidTargets.IsEmpty || info.ValidTargets.Overlaps(a.GetEnabledTargetTypes()))
&& (info.InvalidTargets.IsEmpty || !info.InvalidTargets.Overlaps(a.GetEnabledTargetTypes()))
&& a.TraitsImplementing<ExternalCondition>().Any(t => t.Info.Condition == info.Condition && t.CanGrantCondition(Self))
&& (!info.TargetMustBeVisible || Self.Owner.Shroud.IsVisible(a.Location))
&& a.CanBeViewedByPlayer(Self.Owner)
Expand Down
6 changes: 6 additions & 0 deletions OpenRA.Mods.CA/Traits/SupportPowers/RecallPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ sealed class RecallPowerInfo : SupportPowerInfo
[Desc("Target types that cannot be recalled.")]
public readonly BitSet<TargetableType> InvalidTargetTypes = default(BitSet<TargetableType>);

[Desc("Player relationships that can be recalled.")]
public readonly PlayerRelationship ValidRelationships = PlayerRelationship.Ally;

[CursorReference]
[Desc("Cursor to display when the targeted area is blocked.")]
public readonly string TargetBlockedCursor = "move-blocked";
Expand Down Expand Up @@ -178,6 +181,9 @@ public bool IsValidTarget(Actor a)
if (a == null || !a.IsInWorld || a.IsDead)
return false;

if (!info.ValidRelationships.HasRelationship(Self.Owner.RelationshipWith(a.Owner)))
return false;

var targetTypes = a.GetEnabledTargetTypes();

if (!targetTypes.Overlaps(info.ValidTargetTypes))
Expand Down
79 changes: 79 additions & 0 deletions OpenRA.Mods.CA/Warheads/GrantExternalConditionCAWarhead.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#region Copyright & License Information
/*
* Copyright (c) The OpenRA Developers and Contributors
* 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion

using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;

namespace OpenRA.Mods.Common.Warheads
{
[Desc("Grant an external condition to hit actors.")]
public class GrantExternalConditionCAWarhead : Warhead
{
[FieldLoader.Require]
[Desc("The condition to apply. Must be included in the target actor's ExternalConditions list.")]
public readonly string Condition = null;

[Desc("Duration of the condition (in ticks). Set to 0 for a permanent condition.")]
public readonly int Duration = 0;

public readonly WDist Range = WDist.FromCells(1);

public readonly WDist RangeLimit = WDist.FromCells(2);

public override void DoImpact(in Target target, WarheadArgs args)
{
var firedBy = args.SourceActor;

if (target.Type == TargetType.Invalid)
return;

var rangeLimit = Range > RangeLimit ? Range : RangeLimit;
var actors = firedBy.World.FindActorsInCircle(target.CenterPosition, rangeLimit);

foreach (var a in actors)
{
if (!IsValidAgainst(a, firedBy))
continue;

HitShape closestActiveShape = null;
var closestDistance = int.MaxValue;

// PERF: Avoid using TraitsImplementing<HitShape> that needs to find the actor in the trait dictionary.
foreach (var targetPos in a.EnabledTargetablePositions)
{
if (targetPos is HitShape hitshape)
{
var distance = hitshape.DistanceFromEdge(a, target.CenterPosition).Length;
if (distance < closestDistance)
{
closestDistance = distance;
closestActiveShape = hitshape;
}
}
}

// Cannot be damaged without an active HitShape.
if (closestActiveShape == null)
continue;

// Cannot be damaged if HitShape is outside Spread.
if (closestDistance > Range.Length)
continue;

a.TraitsImplementing<ExternalCondition>()
.FirstOrDefault(t => t.Info.Condition == Condition && t.CanGrantCondition(firedBy))
?.GrantCondition(a, firedBy, Duration);
}
}
}
}
Binary file modified mods/ca/bits/gpsdot.shp
Binary file not shown.
Binary file modified mods/ca/bits/ifvtur.shp
Binary file not shown.
Binary file added mods/ca/bits/scrin/audio/mshp-stmrcharge.aud
Binary file not shown.
Binary file added mods/ca/bits/scrin/scrinmuzz7.shp
Binary file not shown.
4 changes: 4 additions & 0 deletions mods/ca/languages/rules/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ checkbox-balanced-harvesting =
.label = Balanced Harvesting
.description = Enables dynamic harvester speed to account for the direction of resources relative to refineries
checkbox-fast-regrowth =
.label = Fast Regrowth
.description = Resources regrow at a faster rate
dropdown-queuetype =
.label = Production Type
.description = Single-Queue = One queue per production category\n\nMulti-Queue = One queue per production structure\n\nMulti-Queue Scaled = Multi-Queue, but where additional production structures have increased cost,\n which can be reduced via T2/T3 upgrades
Expand Down
2 changes: 0 additions & 2 deletions mods/ca/maps/ca07-subversion/rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ HTNK.Drone:
PauseOnCondition: empdisable || being-warped
Tooltip:
GenericVisibility: None
Voiced:
-RequiresCondition:

MTNK.Drone:
-ExternalCondition@DRONECONTROL:
Expand Down
4 changes: 2 additions & 2 deletions mods/ca/maps/ca07-subversion/weapons.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Hack:
Range: 8c0
Warhead@immobilise: GrantExternalCondition
Warhead@immobilise: GrantExternalConditionCA
Range: 0c511
Duration: 50
Condition: notmobile
Expand All @@ -25,7 +25,7 @@ IonBolt:
Damage: 4000

MEMP:
Warhead@emp: GrantExternalCondition
Warhead@emp: GrantExternalConditionCA
Duration: 600

StnkMissile:
Expand Down
2 changes: 1 addition & 1 deletion mods/ca/maps/ca15-domination/weapons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MicrowaveZap:
Warhead@1Dam: SpreadDamage
Versus:
None: 25
Warhead@empdef: GrantExternalCondition
Warhead@empdef: GrantExternalConditionCA
Range: 0c511
Duration: 175

Expand Down
2 changes: 1 addition & 1 deletion mods/ca/maps/ca25-singularity/weapons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ MothershipExplosion:
Spread: 8c0
Damage: 80000
ValidTargets: Wall
Warhead@emp: GrantExternalCondition
Warhead@emp: GrantExternalConditionCA
Range: 20c0
Duration: 3000
Condition: empdisable
Expand Down
8 changes: 4 additions & 4 deletions mods/ca/maps/ca30-reckoning/weapons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ ExterminatorLaserReversed:
FollowingOffset: 50,100,0

MicrowaveZap:
Warhead@emp: GrantExternalCondition
Warhead@emp: GrantExternalConditionCA
InvalidTargets: ExterminatorTripod

MicrowaveZap.UPG:
Warhead@emp2: GrantExternalCondition
Warhead@emp2: GrantExternalConditionCA
Range: 0c511
Duration: 50
Condition: empdisable
Expand All @@ -50,9 +50,9 @@ C4:
ValidTargets: ExterminatorTripod

EnlightenedEmp:
Warhead@1Emp: GrantExternalCondition
Warhead@1Emp: GrantExternalConditionCA
InvalidTargets: ExterminatorTripod
Warhead@empExterminator: GrantExternalCondition
Warhead@empExterminator: GrantExternalConditionCA
Range: 0c896
Duration: 30
Condition: empdisable
Expand Down
2 changes: 2 additions & 0 deletions mods/ca/maps/tfca/tfca-rules-base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ Player:
Visible: False
LobbyPrerequisiteCheckbox@BALANCEDHARVESTING:
Visible: False
LobbyPrerequisiteCheckbox@FASTREGROWTH:
Visible: False
LobbyPrerequisiteCheckbox@REVEALONFIRE:
Enabled: False
Locked: True
Expand Down
2 changes: 1 addition & 1 deletion mods/ca/maps/tfca/tfca-weapons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Heal:

Repair:
ReloadDelay: 40
Warhead@highlight: GrantExternalCondition
Warhead@highlight: GrantExternalConditionCA
ValidTargets: Structure
Warhead@1Dam: SpreadDamage
Damage: -3500
Expand Down
3 changes: 1 addition & 2 deletions mods/ca/rules/aircraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,6 @@ NHAW:
Inherits: ^Helicopter
Inherits@AUTOTARGET: ^AutoTargetGroundAssaultMove
Inherits@TRANSPORT: ^Transport
Inherits@SELECTION: ^SelectableSupportUnit
RenderSprites:
Image: nhaw
Buildable:
Expand Down Expand Up @@ -955,7 +954,7 @@ NHAW:
Count: 2
RequiresCondition: upg-crym
AutoTarget:
InitialStance: ReturnFire
InitialStance: Defend
InitialStanceAI: AttackAnything
HoldFireCondition: stance-holdfire
AttackAircraft:
Expand Down
3 changes: 3 additions & 0 deletions mods/ca/rules/custom/campaign-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Player:
LobbyPrerequisiteCheckbox@BALANCEDHARVESTING:
Locked: True
Visible: False
LobbyPrerequisiteCheckbox@FASTREGROWTH:
Locked: True
Visible: False
LobbyPrerequisiteCheckbox@REVEALONFIRE:
Locked: True
Visible: False
Expand Down
3 changes: 3 additions & 0 deletions mods/ca/rules/custom/composition-tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ Player:
LobbyPrerequisiteCheckbox@BALANCEDHARVESTING:
Enabled: True
Visible: False
LobbyPrerequisiteCheckbox@FASTREGROWTH:
Enabled: False
Visible: False
LobbyPrerequisiteCheckbox@REVEALONFIRE:
Enabled: False
Locked: True
Expand Down
2 changes: 2 additions & 0 deletions mods/ca/rules/custom/mastermind-madness.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ Player:
Visible: False
LobbyPrerequisiteCheckbox@BALANCEDHARVESTING:
Visible: False
LobbyPrerequisiteCheckbox@FASTREGROWTH:
Visible: False
LobbyPrerequisiteCheckbox@REVEALONFIRE:
Enabled: False
Locked: True
Expand Down
2 changes: 2 additions & 0 deletions mods/ca/rules/custom/scrinfestation-minigame.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Player:
Visible: False
LobbyPrerequisiteCheckbox@BALANCEDHARVESTING:
Visible: False
LobbyPrerequisiteCheckbox@FASTREGROWTH:
Visible: False
LobbyPrerequisiteCheckbox@REVEALONFIRE:
Enabled: False
Locked: True
Expand Down
5 changes: 4 additions & 1 deletion mods/ca/rules/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@
Step: 500
Delay: 75
StartIfBelow: 100
DamageCooldown: 200
DamageCooldown: 100
RequiresCondition: hospitalheal
ExternalCondition@HOSPITAL:
Condition: hospitalheal
Expand Down Expand Up @@ -3236,6 +3236,9 @@
Condition: on-tib
Range: 4c0
ValidRelationships: Ally, Neutral, Enemy
GrantConditionOnPrerequisite@FastRegrowth:
Condition: fast-regrowth
Prerequisites: global.fastregrowth

^Tree:
Inherits@1: ^SpriteActor
Expand Down
6 changes: 4 additions & 2 deletions mods/ca/rules/infantry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ U3.squad:
Queue: InfantrySQ, InfantryMQ
BuildAtProductionType: ParadropInfantry
BuildPaletteOrder: 1000
Prerequisites: dome, ~infantry.usa, ~techlevel.medium
Prerequisites: radaroraircraft, ~infantry.usa, ~techlevel.medium
Description: Prepare five Guardian GIs for airdrop.
TooltipExtras:
Strengths: • Strong vs Heavy Armor, Aircraft, Buildings, Defenses
Expand Down Expand Up @@ -3774,7 +3774,7 @@ SEAL:
Tooltip:
Name: Navy SEAL
Health:
HP: 18000
HP: 16000
UpdatesPlayerStatistics:
AddToArmyValue: true
Buildable:
Expand Down Expand Up @@ -3844,6 +3844,8 @@ SEAL:
WithDecoration@COMMANDOSKULL:
Sequence: pip-seal
-Targetable@HERO:
-Targetable@MindControlImmune:
-Targetable@ChaosImmune:
GrantConditionOnHealingReceived@HEALINGCOOLDOWN:
RequiredHealing: 40000

Expand Down

0 comments on commit ee778c8

Please sign in to comment.