Skip to content

Commit

Permalink
Merge branch 'OpenRA:bleed' into chore/minimal-devcontainer
Browse files Browse the repository at this point in the history
  • Loading branch information
thumperward authored Oct 11, 2023
2 parents b5cc83f + 85c8f6c commit e28b7f2
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion OpenRA.Game/OpenRA.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Linguini.Bundle" Version="0.5.0" />
<PackageReference Include="Linguini.Bundle" Version="0.6.0" />
<PackageReference Include="OpenRA-Eluant" Version="1.0.22" />
<PackageReference Include="Mono.NAT" Version="3.0.4" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
Expand Down
3 changes: 2 additions & 1 deletion OpenRA.Mods.Common/Activities/UnloadCargo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ public override bool Tick(Actor self)

var move = actor.Trait<IMove>();
var pos = actor.Trait<IPositionable>();
var passenger = actor.Trait<Passenger>();

pos.SetPosition(actor, exitSubCell.Value.Cell, exitSubCell.Value.SubCell);
pos.SetCenterPosition(actor, spawn);

actor.CancelActivity();
passenger.OnBeforeAddedToWorld(actor);
w.Add(actor);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public LuaTable ReinforceWithTransport(Player owner, string actorType, string[]
// Scripted cargo aircraft must turn to default position before unloading.
// TODO: pass facing through UnloadCargo instead.
if (aircraft != null)
transport.QueueActivity(new Land(transport, Target.FromCell(transport.World, entryPath.Last()), WDist.FromCells(dropRange), aircraft.Info.InitialFacing));
transport.QueueActivity(new Land(transport, Target.FromCell(transport.World, entryPath.Last()), WDist.FromCells(dropRange)));

if (cargo != null)
transport.QueueActivity(new UnloadCargo(transport, WDist.FromCells(dropRange)));
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Scripting/LuaScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace OpenRA.Mods.Common.Scripting
{
[TraitLocation(SystemActors.World)]
[Desc("Part of the new Lua API.")]
public class LuaScriptInfo : TraitInfo, Requires<SpawnMapActorsInfo>
public class LuaScriptInfo : TraitInfo, Requires<SpawnMapActorsInfo>, NotBefore<SpawnStartingUnitsInfo>
{
[Desc("File names with location relative to the map.")]
public readonly HashSet<string> Scripts = new();
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/AutoCrusher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void INotifyIdle.TickIdle(Actor self)
self.Location != a.Location && a.IsAtGroundLevel() &&
Info.TargetRelationships.HasRelationship(self.Owner.RelationshipWith(a.Owner)) &&
a.TraitsImplementing<ICrushable>().Any(c => c.CrushableBy(a, self, Info.CrushClasses)))
.ClosestToWithPathFrom(self); // TODO: Make it use shortest pathfinding distance instead
.ClosestToWithPathFrom(self);

if (crushableActor == null)
return;
Expand Down
3 changes: 1 addition & 2 deletions OpenRA.Mods.Common/Traits/Cargo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,7 @@ void INotifyKilled.Killed(Actor self, AttackInfo e)
foreach (var nbm in nbms)
nbm.OnNotifyBlockingMove(passenger, passenger);

// For show.
passenger.QueueActivity(new Nudge(passenger));
passenger.Trait<Passenger>().OnEjectedFromKilledCargo(passenger);
}
else
passenger.Kill(e.Attacker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
namespace OpenRA.Mods.Common.Traits
{
[Desc("Allow deploying on specified charge to grant a condition for a specified duration.")]
public class GrantConditionOnDeployWithChargeInfo : PausableConditionalTraitInfo, Requires<IMoveInfo>, IRulesetLoaded
public class GrantConditionOnDeployWithChargeInfo : PausableConditionalTraitInfo, IRulesetLoaded
{
[FieldLoader.Require]
[GrantedConditionReference]
Expand Down
9 changes: 3 additions & 6 deletions OpenRA.Mods.Common/Traits/FireWarheads.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
namespace OpenRA.Mods.Common.Traits
{
[Desc("Detonate defined warheads at the current location at a set interval.")]
public class FireWarheadsInfo : PausableConditionalTraitInfo, Requires<IMoveInfo>, IRulesetLoaded
public class FireWarheadsInfo : PausableConditionalTraitInfo, Requires<IOccupySpaceInfo>, IRulesetLoaded
{
[WeaponReference]
[FieldLoader.Require]
Expand Down Expand Up @@ -72,11 +72,8 @@ void ITick.Tick(Actor self)
foreach (var wep in Info.WeaponInfos)
{
wep.Impact(Target.FromPos(self.CenterPosition), self);
self.World.AddFrameEndTask(world =>
{
if (wep.Report != null && wep.Report.Length > 0)
Game.Sound.Play(SoundType.World, wep.Report, world, self.CenterPosition);
});
if (wep.Report != null && wep.Report.Length > 0)
Game.Sound.Play(SoundType.World, wep.Report, self.World, self.CenterPosition);
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions OpenRA.Mods.Common/Traits/Passenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ public void Unreserve(Actor self)
ReservedCargo = null;
}

public virtual void OnBeforeAddedToWorld(Actor actor)
{
actor.CancelActivity();
}

public virtual void OnEjectedFromKilledCargo(Actor self)
{
// Cancel all other activities to keep consistent behavior with the one in UnloadCargo.
self.CurrentActivity?.Cancel(self);

self.QueueActivity(new Nudge(self));
}

void INotifyKilled.Killed(Actor self, AttackInfo e)
{
if (Transport == null)
Expand Down
7 changes: 6 additions & 1 deletion OpenRA.Mods.Common/Traits/Render/ProductionBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ void ITick.Tick(Actor self)
return;

var current = queue.AllQueued().Where(i => i.Started).MinByOrDefault(i => i.RemainingTime);
value = current != null ? 1 - (float)current.RemainingCost / current.TotalCost : 0;
if (current == null)
value = 0;
else if (current.TotalCost <= 0)
value = 1;
else
value = 1 - (float)current.RemainingCost / current.TotalCost;
}

float ISelectionBar.GetValue()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Check our [Playing the Game](https://github.com/OpenRA/OpenRA/wiki/Playing-the-g
## Support

* Sponsor a [mirror server](https://github.com/OpenRA/OpenRAWebsiteV3/tree/master/packages) if you have some bandwidth to spare.
* You can immediately set up a [Dedicated](https://github.com/OpenRA/OpenRA/wiki/Dedicated) Game Server.
* You can immediately set up a [Dedicated](https://github.com/OpenRA/OpenRA/wiki/Dedicated-Server) Game Server.

## License
Copyright (c) OpenRA Developers and Contributors
Expand Down

0 comments on commit e28b7f2

Please sign in to comment.