Skip to content

Commit

Permalink
Complete? the rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
MustaphaTR committed Jan 23, 2019
1 parent c8a9203 commit a51739c
Show file tree
Hide file tree
Showing 64 changed files with 745 additions and 748 deletions.
2 changes: 1 addition & 1 deletion OpenRA.Game/Graphics/WorldRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public sealed class WorldRenderer : IDisposable
readonly HashSet<Actor> onScreenActors = new HashSet<Actor>();
readonly HardwarePalette palette = new HardwarePalette();
readonly Dictionary<string, PaletteReference> palettes = new Dictionary<string, PaletteReference>();
readonly TerrainRenderer terrainRenderer;
readonly IRenderTerrain terrainRenderer;
readonly Lazy<DebugVisualizations> debugVis;
readonly Func<string, PaletteReference> createPaletteReference;
readonly bool enableDepthBuffer;
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Cnc/Activities/LayMines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Activity IDockActivity.ApproachDockActivities(Actor host, Actor client, Dock doc
Activity IDockActivity.DockActivities(Actor host, Actor client, Dock dock)
{
return ActivityUtils.SequenceActivities(
new Rearm(client),
new Rearm(client, host, new WDist(512)),
new Repair(client, host, new WDist(512)));
}

Expand Down
1 change: 0 additions & 1 deletion OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
<Compile Include="CncLoadScreen.cs" />
<Compile Include="Traits\EdibleByLeap.cs" />
<Compile Include="Traits\Attack\AttackPopupTurreted.cs" />
<Compile Include="Traits\AttackPopupTurreted.cs" />
<Compile Include="Traits\Buildings\ProductionAirdrop.cs" />
<Compile Include="Traits\Infiltration\InfiltrateForTransform.cs" />
<Compile Include="Traits\Render\WithGunboatBody.cs" />
Expand Down
1 change: 1 addition & 0 deletions OpenRA.Mods.Cnc/Traits/Disguise.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Linq;
using OpenRA.Mods.Common.Orders;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.Common.Traits.Render;
using OpenRA.Primitives;
using OpenRA.Traits;

Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Cnc/Traits/TDGunboat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public bool CanEnterTargetNow(Actor self, Target target)
return false;
}

bool IMove.TurnWhileDisabled(Actor self)
public bool TurnWhileDisabled(Actor self)
{
return false;
}
Expand Down
5 changes: 1 addition & 4 deletions OpenRA.Mods.Common/Activities/Air/HeliReturnToBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ IEnumerable<Actor> GetHelipads(Actor self)
{
return self.World.ActorsHavingTrait<DockManager>().Where(a =>
a.Owner == self.Owner &&
aircraft.Info.RearmBuildings.Contains(a.Info.Name) &&
rearmable.Info.RearmActors.Contains(a.Info.Name) &&
!a.IsDead &&
!a.Disposed);
}
Expand Down Expand Up @@ -97,9 +97,6 @@ public override Activity Tick(Actor self)
NextActivity);
}

if (aircraft.Info.TurnToDock)
landingProcedures.Add(new Turn(self, initialFacing));

// Do we need to land and reload/repair?
if (!ShouldLandAtBuilding(self, dest))
{
Expand Down
10 changes: 5 additions & 5 deletions OpenRA.Mods.Common/Activities/Air/ReturnToBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public ReturnToBase(Actor self, bool abortOnResupply, Actor dest = null, bool al

public static IEnumerable<Actor> GetAirfields(Actor self)
{
var rearmBuildings = self.Info.TraitInfo<AircraftInfo>().RearmBuildings;
var rearmActors = self.Info.TraitInfo<RearmableInfo>().RearmActors;
return self.World.ActorsHavingTrait<DockManager>()
.Where(a => a.Owner == self.Owner && rearmBuildings.Contains(a.Info.Name));
.Where(a => a.Owner == self.Owner && rearmActors.Contains(a.Info.Name));
}

int CalculateTurnRadius(int speed)
Expand All @@ -53,7 +53,7 @@ int CalculateTurnRadius(int speed)
void CalculateLandingPath(Actor self, Dock dock, out WPos w1, out WPos w2, out WPos w3)
{
var landPos = dock.CenterPosition;
var altitude = aircraftInfo.CruiseAltitude.Length;
var altitude = aircraft.Info.CruiseAltitude.Length;

// Distance required for descent.
var landDistance = altitude * 1024 / aircraft.Info.MaximumPitch.Tan();
Expand All @@ -63,7 +63,7 @@ void CalculateLandingPath(Actor self, Dock dock, out WPos w1, out WPos w2, out W

// Add 10% to the turning radius to ensure we have enough room
var speed = aircraft.MovementSpeed * 32 / 35;
var turnRadius = CalculateTurnRadius(aircraftInfo, speed);
var turnRadius = CalculateTurnRadius(speed);

// Find the center of the turning circles for clockwise and counterclockwise turns
var angle = WAngle.FromFacing(aircraft.Facing);
Expand Down Expand Up @@ -168,7 +168,7 @@ public Activity LandingProcedure(Actor self, Dock dock)

List<Activity> landingProcedures = new List<Activity>();

var turnRadius = CalculateTurnRadius(aircraft.Info, aircraft.Info.Speed);
var turnRadius = CalculateTurnRadius(aircraft.Info.Speed);

landingProcedures.Add(new Fly(self, Target.FromPos(w1), WDist.Zero, new WDist(turnRadius * 3)));
landingProcedures.Add(new Fly(self, Target.FromPos(w2)));
Expand Down
1 change: 1 addition & 0 deletions OpenRA.Mods.Common/Activities/Transform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
#endregion

using System.Linq;
using OpenRA.Activities;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.Common.Traits.Render;
Expand Down
2 changes: 0 additions & 2 deletions OpenRA.Mods.Common/OpenRA.Mods.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@
<Compile Include="Effects\SpriteEffect.cs" />
<Compile Include="Graphics\RailgunRenderable.cs" />
<Compile Include="Lint\CheckNotifications.cs" />
<Compile Include="Effects\LaunchEffect.cs" />
<Compile Include="Orders\EnterSharedTransportTargeter.cs" />
<Compile Include="Projectiles\AreaBeam.cs" />
<Compile Include="Projectiles\Bullet.cs" />
Expand Down Expand Up @@ -212,7 +211,6 @@
<Compile Include="ActorInitializer.cs" />
<Compile Include="Projectiles\Railgun.cs" />
<Compile Include="Scripting\Properties\AmmoPoolProperties.cs" />
<Compile Include="Scripting\Properties\HackyAIProperties.cs" />
<Compile Include="Scripting\Properties\RepairableProperties.cs" />
<Compile Include="ShroudExts.cs" />
<Compile Include="Orders\BeaconOrderGenerator.cs" />
Expand Down
10 changes: 5 additions & 5 deletions OpenRA.Mods.Common/Orders/PlaceBuildingOrderGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ IEnumerable<Order> InnerOrder(World world, CPos cell, MouseInput mi)
{
var orderType = "PlaceBuilding";
var topLeft = viewport.ViewToWorld(Viewport.LastMousePos + topLeftScreenOffset);
var cannotBuildAudio = buildableInfo.CannotBuildAudio != null ? buildableInfo.CannotBuildAudio : queue.Info.CannotPlaceNotification;
var cannotBuildAudio = buildableInfo.CannotBuildAudio != null ? buildableInfo.CannotBuildAudio : queue.Info.CannotBuildAudio;

var plugInfo = actorInfo.TraitInfoOrDefault<PlugInfo>();
if (plugInfo != null)
Expand All @@ -125,7 +125,7 @@ IEnumerable<Order> InnerOrder(World world, CPos cell, MouseInput mi)
else
{
if (!world.CanPlaceBuilding(topLeft, actorInfo, buildingInfo, null)
|| !buildingInfo.IsCloseEnoughToBase(world, owner, actorInfo, topLeft))
|| !buildingInfo.IsCloseEnoughToBase(world, owner, actorInfo, queue.Actor, topLeft))
{
foreach (var order in ClearBlockersOrders(world, topLeft))
yield return order;
Expand Down Expand Up @@ -201,9 +201,9 @@ public IEnumerable<IRenderable> RenderAboveShroud(WorldRenderer wr, World world)

if (!Game.GetModifierKeys().HasModifier(Modifiers.Shift))
foreach (var t in BuildingUtils.GetLineBuildCells(world, topLeft, actorInfo, buildingInfo))
cells.Add(t.First, MakeCellType(buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, t.First), true));
cells.Add(t.First, MakeCellType(buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, queue.Actor, t.First), true));

cells[topLeft] = MakeCellType(buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, topLeft));
cells[topLeft] = MakeCellType(buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, queue.Actor, topLeft));
}
else
{
Expand Down Expand Up @@ -235,7 +235,7 @@ public IEnumerable<IRenderable> RenderAboveShroud(WorldRenderer wr, World world)
yield return r;

var res = world.WorldActor.TraitOrDefault<ResourceLayer>();
var isCloseEnough = buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, topLeft);
var isCloseEnough = buildingInfo.IsCloseEnoughToBase(world, world.LocalPlayer, actorInfo, queue.Actor, topLeft);
foreach (var t in buildingInfo.Tiles(topLeft))
cells.Add(t, MakeCellType(isCloseEnough && world.IsCellBuildable(t, actorInfo, buildingInfo) && (res == null || res.GetResource(t) == null)));
}
Expand Down
45 changes: 0 additions & 45 deletions OpenRA.Mods.Common/Scripting/Properties/HackyAIProperties.cs

This file was deleted.

9 changes: 4 additions & 5 deletions OpenRA.Mods.Common/Traits/Air/Aircraft.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ public class AircraftInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IMoveInf
[Desc("Can the actor be ordered to move in to shroud?")]
public readonly bool MoveIntoShroud = true;

public virtual object Create(ActorInitializer init) { return new Aircraft(init, this); }
public int GetInitialFacing() { return InitialFacing; }
public WDist GetCruiseAltitude() { return CruiseAltitude; }

[VoiceReference] public readonly string Voice = "Action";

[GrantedConditionReference]
Expand Down Expand Up @@ -366,8 +362,11 @@ public Actor GetSupplierActorBelow()
if (self.World.Map.DistanceAboveTerrain(CenterPosition).Length != 0)
return null; // not on the ground.

if (rearmableInfo == null && repairableInfo == null)
return null;

return self.World.ActorMap.GetActorsAt(self.Location)
.FirstOrDefault(a => Info.RearmBuildings.Contains(a.Info.Name) || Info.RepairBuildings.Contains(a.Info.Name));
.FirstOrDefault(a => rearmableInfo.RearmActors.Contains(a.Info.Name) || repairableInfo.RepairBuildings.Contains(a.Info.Name));
}

protected void ReserveSpawnBuilding()
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/Armament.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public virtual Barrel CheckFire(Actor self, IFacing facing, Target target)
currentBarrel++;

foreach (var na in notifyAttacks)
na.PreparingAttack(self, target, this, barrel)
na.PreparingAttack(self, target, this, barrel);

Func<WPos> muzzlePosition = () => self.CenterPosition + MuzzleOffset(self, barrel);
var legacyFacing = MuzzleOrientation(self, barrel).Yaw.Angle / 4;
Expand Down
Loading

0 comments on commit a51739c

Please sign in to comment.