Building capture eva + wtf on silo capture
This commit is contained in:
@@ -27,17 +27,16 @@ namespace OpenRA.Mods.RA.Activities
|
||||
target.World.AddFrameEndTask(w =>
|
||||
{
|
||||
// momentarily remove from world so the ownership queries don't get confused
|
||||
var oldOwner = target.Owner;
|
||||
w.Remove(target);
|
||||
target.Owner = self.Owner;
|
||||
w.Add(target);
|
||||
|
||||
foreach (var t in target.traits.WithInterface<INotifyCapture>())
|
||||
t.OnCapture(target, self);
|
||||
t.OnCapture(target, self, oldOwner, self.Owner);
|
||||
|
||||
w.Remove(self);
|
||||
});
|
||||
|
||||
// the engineer is sacrificed.
|
||||
self.World.AddFrameEndTask(w => w.Remove(self));
|
||||
|
||||
return NextActivity;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
<Compile Include="RadarColorFromTerrain.cs" />
|
||||
<Compile Include="EngineerRepair.cs" />
|
||||
<Compile Include="Activities\RepairBuilding.cs" />
|
||||
<Compile Include="BuildingCaptureNotification.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.RA
|
||||
self.traits.Get<IAcceptOreDockAction>().OnDock(self, harv, dockOrder);
|
||||
}
|
||||
|
||||
public void OnCapture (Actor self, Actor captor)
|
||||
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||
{
|
||||
// Unlink any non-docked harvs
|
||||
foreach (var harv in LinkedHarv)
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Mods.RA
|
||||
}));
|
||||
}
|
||||
|
||||
public void OnCapture (Actor self, Actor captor)
|
||||
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||
{
|
||||
if (dockedHarv == null)
|
||||
return;
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
class StoresOre : IPips, INotifyCapture, INotifyDamage, IExplodeModifier, IStoreOre
|
||||
{
|
||||
readonly PlayerResources Player;
|
||||
readonly StoresOreInfo Info;
|
||||
|
||||
PlayerResources Player;
|
||||
public StoresOre(Actor self, StoresOreInfo info)
|
||||
{
|
||||
Player = self.Owner.PlayerActor.traits.Get<PlayerResources>();
|
||||
@@ -34,10 +34,11 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public int Capacity { get { return Info.Capacity; } }
|
||||
|
||||
public void OnCapture(Actor self, Actor captor)
|
||||
public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||
{
|
||||
var ore = Stored(self);
|
||||
Player.TakeOre(ore);
|
||||
Player = newOwner.PlayerActor.traits.Get<PlayerResources>();
|
||||
Player.GiveOre(ore);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user