Building capture eva + wtf on silo capture
This commit is contained in:
@@ -42,7 +42,7 @@ namespace OpenRA.Traits
|
||||
public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); }
|
||||
public interface INotifyBuildComplete { void BuildingComplete(Actor self); }
|
||||
public interface INotifyProduction { void UnitProduced(Actor self, Actor other); }
|
||||
public interface INotifyCapture { void OnCapture(Actor self, Actor captor); }
|
||||
public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner); }
|
||||
public interface IAcceptSpy { void OnInfiltrate(Actor self, Actor spy); }
|
||||
public interface INotifyEnterCell { void OnEnterCell(Actor self, int2 cell); }
|
||||
public interface IProvideHazard { IEnumerable<HazardLayer.Hazard> HazardCells(Actor self); }
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Cnc
|
||||
CancelDock(self, dockedHarv);
|
||||
}
|
||||
|
||||
public void OnCapture (Actor self, Actor captor)
|
||||
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner)
|
||||
{
|
||||
if (dockedHarv == null)
|
||||
return;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,12 @@
|
||||
ActorTypes: c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,e1,e1,e1,e1,e1,e1,e1
|
||||
MustBeDestroyed:
|
||||
GivesExperience:
|
||||
CaptureNotification@GDI:
|
||||
Race: gdi
|
||||
Notification: gdicapt1.aud
|
||||
CaptureNotification@NOD:
|
||||
Race: nod
|
||||
Notification: nodcapt1.aud
|
||||
|
||||
^CivBuilding:
|
||||
Inherits: ^Building
|
||||
|
||||
@@ -93,7 +93,8 @@
|
||||
MustBeDestroyed:
|
||||
GivesExperience:
|
||||
FrozenUnderFog:
|
||||
|
||||
CaptureNotification:
|
||||
Notification: strucap1.aud
|
||||
^Wall:
|
||||
Category: Building
|
||||
Building:
|
||||
|
||||
Reference in New Issue
Block a user