Add hijackable truck to Allies 04

This commit is contained in:
Scott_NZ
2012-12-16 13:30:20 +13:00
parent fda897c69e
commit 54feab66e0
4 changed files with 121 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
#region Copyright & License Information
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
@@ -9,6 +9,7 @@
#endregion
using System.Linq;
using OpenRA.Mods.RA.Buildings;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
@@ -30,9 +31,17 @@ namespace OpenRA.Mods.RA.Activities
foreach (var t in target.TraitsImplementing<IAcceptSpy>())
t.OnInfiltrate(target, self);
self.Destroy();
if (self.HasTrait<DontDestroyWhenInfiltrating>())
self.World.AddFrameEndTask(w =>
{
if (self.Destroyed) return;
w.Remove(self);
});
else
self.Destroy();
Sound.PlayToPlayer(self.Owner, "bldginf1.aud");
if (target.HasTrait<Building>())
Sound.PlayToPlayer(self.Owner, "bldginf1.aud");
return this;
}