C4 demolishable bridges
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
NEW:
|
||||
Dune 2000:
|
||||
Added the Atreides grenadier from the 1.06 patch.
|
||||
Red Alert:
|
||||
Tanya can now plant C4 on bridges.
|
||||
Tiberian Dawn:
|
||||
Commando can now plant C4 on bridges.
|
||||
Engine:
|
||||
Converted Aircraft CruiseAltitude to world coordinates.
|
||||
Converted Health Radius to world coordinates.
|
||||
@@ -9,8 +15,7 @@ NEW:
|
||||
Altitude is no longer parsed from actor templates in maps. Specify CenterPosition instead.
|
||||
Run `OpenRA.Utility.exe --upgrade-mod <mod> 20131223` to automatically upgrade mod rules.
|
||||
Run `OpenRA.Utility.exe --upgrade-map <map path> 20131223` to automatically upgrade custom map rules.
|
||||
Dune 2000:
|
||||
Added the Atreides grenadier from the 1.06 patch.
|
||||
Added a new trait Demolishable for buildings to handle the C4 demolition.
|
||||
|
||||
20131223:
|
||||
All mods:
|
||||
|
||||
@@ -77,6 +77,11 @@ namespace OpenRA.Traits
|
||||
public interface INotifyHarvest { void Harvested(Actor self, ResourceType resource); }
|
||||
|
||||
public interface IAcceptInfiltrator { void OnInfiltrate(Actor self, Actor infiltrator); }
|
||||
public interface IDemolishable
|
||||
{
|
||||
void Demolish(Actor self, Actor saboteur);
|
||||
bool IsValidTarget(Actor self, Actor saboteur);
|
||||
}
|
||||
public interface IStoreOre { int Capacity { get; } }
|
||||
public interface IToolTip
|
||||
{
|
||||
|
||||
@@ -41,8 +41,12 @@ namespace OpenRA.Mods.RA.Activities
|
||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
|
||||
.Select(t => t.GetDamageModifier(self, null)).Product();
|
||||
|
||||
var demolishable = target.Actor.TraitOrDefault<IDemolishable>();
|
||||
if (demolishable == null || !demolishable.IsValidTarget(target.Actor, self))
|
||||
return;
|
||||
|
||||
if (modifier > 0)
|
||||
target.Actor.Kill(self);
|
||||
demolishable.Demolish(target.Actor, self);
|
||||
})));
|
||||
|
||||
return NextActivity;
|
||||
|
||||
@@ -288,5 +288,13 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
public void Demolish(Actor saboteur)
|
||||
{
|
||||
// TODO: completely destroy long bridges in a chain reaction
|
||||
Combat.DoExplosion(saboteur, "Demolish", self.CenterPosition);
|
||||
self.World.WorldActor.Trait<ScreenShaker>().AddEffect(15, self.CenterPosition, 6);
|
||||
self.Kill(saboteur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
public object Create(ActorInitializer init) { return new BridgeHut(init); }
|
||||
}
|
||||
|
||||
class BridgeHut
|
||||
class BridgeHut : IDemolishable
|
||||
{
|
||||
public Bridge bridge;
|
||||
|
||||
@@ -31,6 +31,16 @@ namespace OpenRA.Mods.RA
|
||||
bridge.Repair(repairer, true, true);
|
||||
}
|
||||
|
||||
public void Demolish(Actor self, Actor saboteur)
|
||||
{
|
||||
bridge.Demolish(saboteur);
|
||||
}
|
||||
|
||||
public bool IsValidTarget(Actor self, Actor saboteur)
|
||||
{
|
||||
return BridgeDamageState == DamageState.Undamaged;
|
||||
}
|
||||
|
||||
public DamageState BridgeDamageState { get { return bridge.AggregateDamageState(); } }
|
||||
}
|
||||
}
|
||||
|
||||
34
OpenRA.Mods.RA/Buildings/Demolishable.cs
Normal file
34
OpenRA.Mods.RA/Buildings/Demolishable.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
using System;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Handle demolitions from C4 explosives.")]
|
||||
public class DemolishableInfo : TraitInfo<Demolishable> { }
|
||||
|
||||
public class Demolishable : IDemolishable
|
||||
{
|
||||
public Demolishable() { }
|
||||
|
||||
public void Demolish(Actor self, Actor saboteur)
|
||||
{
|
||||
self.Kill(saboteur);
|
||||
}
|
||||
|
||||
public bool IsValidTarget(Actor self, Actor saboteur)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ namespace OpenRA.Mods.RA
|
||||
if (target.Type != TargetType.Actor)
|
||||
return;
|
||||
|
||||
var demolishable = order.TargetActor.TraitOrDefault<IDemolishable>();
|
||||
if (demolishable == null || !demolishable.IsValidTarget(target.Actor, self))
|
||||
return;
|
||||
|
||||
if (!order.Queued)
|
||||
self.CancelActivity();
|
||||
|
||||
|
||||
@@ -125,12 +125,8 @@ namespace OpenRA.Mods.RA.Missions
|
||||
startJeep.QueueActivity(new Turn(128));
|
||||
startJeep.QueueActivity(new CallFunc(() =>
|
||||
{
|
||||
var bridge = world.Actors
|
||||
.Where(a => a.HasTrait<Bridge>() && !a.IsDead())
|
||||
.ClosestTo(startJeep);
|
||||
Combat.DoExplosion(bridge, "Demolish", bridge.CenterPosition);
|
||||
world.WorldActor.Trait<ScreenShaker>().AddEffect(15, bridge.CenterPosition, 6);
|
||||
bridge.Kill(bridge);
|
||||
var bridge = world.Actors.Where(a => a.HasTrait<BridgeHut>()).ClosestTo(startJeep);
|
||||
bridge.Trait<BridgeHut>().Demolish(bridge, startJeep);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -484,6 +484,7 @@
|
||||
<Compile Include="Effects\Rank.cs" />
|
||||
<Compile Include="ShroudRenderer.cs" />
|
||||
<Compile Include="Render\WithCrateBody.cs" />
|
||||
<Compile Include="Buildings\Demolishable.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -363,7 +363,7 @@ BRIDGEHUT:
|
||||
Bounds: 48,48
|
||||
BridgeHut:
|
||||
TargetableBuilding:
|
||||
TargetTypes: BridgeHut
|
||||
TargetTypes: BridgeHut, C4
|
||||
|
||||
C1:
|
||||
Inherits: ^CivInfantry
|
||||
@@ -455,4 +455,3 @@ VICE:
|
||||
QuantizedFacings: 8
|
||||
PoisonedByTiberium:
|
||||
Weapon: Heal
|
||||
|
||||
|
||||
@@ -353,6 +353,7 @@
|
||||
EngineerRepairable:
|
||||
Huntable:
|
||||
LuaScriptEvents:
|
||||
Demolishable:
|
||||
|
||||
^CivBuilding:
|
||||
Inherits: ^Building
|
||||
@@ -456,6 +457,7 @@
|
||||
BodyOrientation:
|
||||
FrozenUnderFog:
|
||||
LuaScriptEvents:
|
||||
Demolishable:
|
||||
|
||||
^Tree:
|
||||
Tooltip:
|
||||
|
||||
@@ -1027,3 +1027,7 @@ Claw:
|
||||
InfDeath: 1
|
||||
Damage: 60
|
||||
|
||||
Demolish:
|
||||
Warhead:
|
||||
ImpactSound: xplobig6.aud
|
||||
Explosion: building
|
||||
@@ -249,4 +249,4 @@
|
||||
WithCrumbleOverlay:
|
||||
Huntable:
|
||||
LuaScriptEvents:
|
||||
|
||||
Demolishable:
|
||||
|
||||
@@ -384,6 +384,7 @@
|
||||
Sellable:
|
||||
Guardable:
|
||||
BodyOrientation:
|
||||
Demolishable:
|
||||
|
||||
WALL:
|
||||
Inherits: ^WALL
|
||||
|
||||
@@ -488,7 +488,7 @@ BRIDGEHUT:
|
||||
Bounds: 48,48
|
||||
BridgeHut:
|
||||
TargetableBuilding:
|
||||
TargetTypes: BridgeHut
|
||||
TargetTypes: BridgeHut, C4
|
||||
|
||||
BRIDGEHUT.small:
|
||||
Building:
|
||||
@@ -499,7 +499,7 @@ BRIDGEHUT.small:
|
||||
Bounds: 24,24
|
||||
BridgeHut:
|
||||
TargetableBuilding:
|
||||
TargetTypes: BridgeHut
|
||||
TargetTypes: BridgeHut, C4
|
||||
|
||||
V20:
|
||||
Inherits: ^DesertCivBuilding
|
||||
|
||||
@@ -264,6 +264,7 @@
|
||||
String: Structure
|
||||
Huntable:
|
||||
LuaScriptEvents:
|
||||
Demolishable:
|
||||
|
||||
^Wall:
|
||||
AppearsOnRadar:
|
||||
@@ -300,6 +301,7 @@
|
||||
BodyOrientation:
|
||||
FrozenUnderFog:
|
||||
LuaScriptEvents:
|
||||
Demolishable:
|
||||
|
||||
^TechBuilding:
|
||||
Inherits: ^Building
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
BodyOrientation:
|
||||
Huntable:
|
||||
LuaScriptEvents:
|
||||
Demolishable:
|
||||
|
||||
^Infantry:
|
||||
AppearsOnRadar:
|
||||
@@ -176,6 +177,7 @@
|
||||
UpdatesPlayerStatistics:
|
||||
BodyOrientation:
|
||||
LuaScriptEvents:
|
||||
Demolishable:
|
||||
|
||||
^Helicopter:
|
||||
AppearsOnRadar:
|
||||
|
||||
Reference in New Issue
Block a user