Skip to content

Commit

Permalink
Fix the build.
Browse files Browse the repository at this point in the history
Removed some shit that i don't use and am too lazy to actually fix.
  • Loading branch information
MustaphaTR committed Mar 28, 2020
1 parent 41f7d49 commit 4a6b5d6
Show file tree
Hide file tree
Showing 19 changed files with 61 additions and 1,090 deletions.
3 changes: 0 additions & 3 deletions OpenRA.Mods.Common/Activities/Enter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ public override Activity Tick(Actor self)
if (useLastVisibleTarget || target.Type != TargetType.Actor)
return NextActivity;

// Otherwise, try to recover from moving target
else if ()

// Are we ready to move into the target?
if (TryStartEnter(self, target.Actor))
{
Expand Down
59 changes: 40 additions & 19 deletions OpenRA.Mods.Common/Activities/EnterSharedTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#endregion

using System;
using System.Drawing;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;

Expand All @@ -18,41 +19,61 @@ namespace OpenRA.Mods.Common.Activities
public class EnterSharedTransport : Enter
{
readonly SharedPassenger passenger;
Actor transport;
SharedCargo cargo;

public EnterSharedTransport(Actor self, Actor transport, int maxTries = 0, bool repathWhileMoving = true)
: base(self, transport, EnterBehaviour.Exit, WDist.Zero, maxTries, repathWhileMoving)
Actor enterActor;
SharedCargo enterCargo;

public EnterSharedTransport(Actor self, Target target)
: base(self, target, WDist.Zero, Color.Green)
{
this.transport = transport;
cargo = transport.Trait<SharedCargo>();
passenger = self.Trait<SharedPassenger>();
}

protected override void Unreserve(Actor self, bool abort) { passenger.Unreserve(self); }
protected override bool CanReserve(Actor self) { return cargo.Unloading || cargo.CanLoad(transport, self); }
protected override ReserveStatus Reserve(Actor self)
protected override bool TryStartEnter(Actor self, Actor targetActor)
{
var status = base.Reserve(self);
if (status != ReserveStatus.Ready)
return status;
if (passenger.Reserve(self, cargo))
return ReserveStatus.Ready;
return ReserveStatus.Pending;
enterActor = targetActor;
enterCargo = targetActor.TraitOrDefault<SharedCargo>();

// Make sure we can still enter the transport
// (but not before, because this may stop the actor in the middle of nowhere)
if (enterCargo == null || !passenger.Reserve(self, enterCargo))
{
Cancel(self, true);
return false;
}

return true;
}

protected override void OnInside(Actor self)
protected override void OnEnterComplete(Actor self, Actor targetActor)
{
self.World.AddFrameEndTask(w =>
{
if (self.IsDead || transport.IsDead || !cargo.CanLoad(transport, self))
// Make sure the target hasn't changed while entering
// OnEnterComplete is only called if targetActor is alive
if (targetActor != enterActor)
return;

if (self.IsDead || enterActor.IsDead || !enterCargo.CanLoad(enterActor, self))
return;

cargo.Load(transport, self);
enterCargo.Load(enterActor, self);
w.Remove(self);

// Preemptively cancel any activities to avoid an edge-case where successively queued
// EnterTransports corrupt the actor state. Activities are cancelled again on unload
self.CancelActivity();
});
}

protected override void OnCancel(Actor self)
{
passenger.Unreserve(self);
}

Done(self);
protected override void OnLastRun(Actor self)
{
passenger.Unreserve(self);
}
}
}
35 changes: 0 additions & 35 deletions OpenRA.Mods.Common/Scripting/Properties/CombatProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,39 +106,4 @@ public bool CanTarget(Actor targetActor)
return Target.FromActor(targetActor).IsValidFor(Self);
}
}

[ScriptPropertyGroup("Combat")]
public class AttackSuicidesProperties : ScriptActorProperties, Requires<AttackSuicidesInfo>, Requires<IMoveInfo>
{
readonly AttackSuicides attackSuicides;
readonly IMove move;

public AttackSuicidesProperties(ScriptContext context, Actor self)
: base(context, self)
{
attackSuicides = self.TraitOrDefault<AttackSuicides>();
move = self.Trait<IMove>();
}

[Desc("Attack the target actor.")]
public void DetonateAttack(Actor targetActor, bool queued = true)
{
if (attackSuicides != null)
{
Self.QueueActivity(move.MoveToTarget(Self, Target.FromActor(targetActor)));
Self.QueueActivity(new CallFunc(() => Self.Kill(Self, attackSuicides.Info.DamageTypes)));
}
else
Log.Write("lua", "Actor {0} doesn't have AttackSuicides trait!", Self);
}

[Desc("Self destruct.")]
public void Detonate()
{
if (attackSuicides != null)
Self.Kill(Self, attackSuicides.Info.DamageTypes);
else
Log.Write("lua", "Actor {0} doesn't have AttackSuicides trait!", Self);
}
}
}
4 changes: 2 additions & 2 deletions OpenRA.Mods.Common/Traits/Attack/AttackFollow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ public override Activity Tick(Actor self)

// Check that AttackFollow hasn't cancelled the target by modifying attack.Target
// Having both this and AttackFollow modify that field is a horrible hack.
if (hasTicked && attackFollows.All(a => a.Target.Type == TargetType.Invalid))
if (hasTicked && attackFollows.All(a => a.requestedTarget.Type == TargetType.Invalid))
return NextActivity;

if (attackFollows.All(a => a.IsTraitPaused))
return this;

bool targetIsHiddenActor;
bool targetIsHiddenActor = false;
foreach (var attack in attackFollows)
{
attack.requestedForceAttack = forceAttack;
Expand Down
4 changes: 2 additions & 2 deletions OpenRA.Mods.Common/Traits/EngineerRepair.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public void ResolveOrder(Actor self, Order order)
if (!order.Queued)
self.CancelActivity();

self.SetTargetLine(target, Color.Yellow);
self.QueueActivity(new RepairBuilding(self, target.Actor, info));
self.SetTargetLine(order.Target, Color.Yellow);
self.QueueActivity(new RepairBuilding(self, order.Target, info.EnterBehaviour, info.ValidStances));
}

class EngineerRepairOrderTargeter : UnitOrderTargeter
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/GivesBounty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int GetDisplayedBountyValue(Actor self, TakesBounty activeAttackerTakesBounty)
foreach (var pb in passengerBounties)
foreach (var b in pb.Value)
if (!b.IsTraitDisabled)
bounty += givesBounty.GetDisplayedBountyValue(a, activeAttackerTakesBounty);
bounty += b.GetDisplayedBountyValue(pb.Key, activeAttackerTakesBounty);

return bounty;
}
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.Common/Traits/SharedPassenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void ResolveOrder(Actor self, Order order)
self.CancelActivity();

self.SetTargetLine(order.Target, Color.Green);
self.QueueActivity(new EnterSharedTransport(self, targetActor));
self.QueueActivity(new EnterSharedTransport(self, order.Target));
}

public bool Reserve(Actor self, SharedCargo cargo)
Expand Down
22 changes: 2 additions & 20 deletions OpenRA.Mods.Gen/Activities/EnterCarrierMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,16 @@ class EnterCarrierMaster : Enter
readonly CarrierMaster spawnerMaster;

public EnterCarrierMaster(Actor self, Actor master, CarrierMaster spawnerMaster, EnterBehaviour enterBehaviour)
: base(self, master, enterBehaviour, WDist.Zero)
: base(self, Target.FromActor(master), WDist.Zero)
{
this.master = master;
this.spawnerMaster = spawnerMaster;
}

protected override bool CanReserve(Actor self)
{
return true; // Slaves are always welcome.
}

protected override ReserveStatus Reserve(Actor self)
{
// TryReserveElseTryAlternateReserve calls Reserve and
// the default inplementation of Reserve() returns TooFar when
// the aircraft carrier is hovering over a building.
// Since spawners don't need reservation (and have no reservation trait),
// just return Ready so that spawner can enter no matter where the spawner is.
return ReserveStatus.Ready;
}

protected override void OnInside(Actor self)
protected override void OnEnterComplete(Actor self, Actor targetActor)
{
// Master got killed :(
if (master.IsDead)
return;

Done(self); // Stop slaves from exiting.

// Load this thingy.
// Issue attack move to the rally point.
Expand Down
114 changes: 0 additions & 114 deletions OpenRA.Mods.Gen/Activities/EnterNydus.cs

This file was deleted.

62 changes: 0 additions & 62 deletions OpenRA.Mods.Gen/Activities/EnterTransportWithWait.cs

This file was deleted.

Loading

0 comments on commit 4a6b5d6

Please sign in to comment.