C4 demolishable bridges
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
NEW:
|
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:
|
Engine:
|
||||||
Converted Aircraft CruiseAltitude to world coordinates.
|
Converted Aircraft CruiseAltitude to world coordinates.
|
||||||
Converted Health Radius 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.
|
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-mod <mod> 20131223` to automatically upgrade mod rules.
|
||||||
Run `OpenRA.Utility.exe --upgrade-map <map path> 20131223` to automatically upgrade custom map rules.
|
Run `OpenRA.Utility.exe --upgrade-map <map path> 20131223` to automatically upgrade custom map rules.
|
||||||
Dune 2000:
|
Added a new trait Demolishable for buildings to handle the C4 demolition.
|
||||||
Added the Atreides grenadier from the 1.06 patch.
|
|
||||||
|
|
||||||
20131223:
|
20131223:
|
||||||
All mods:
|
All mods:
|
||||||
|
|||||||
@@ -77,6 +77,11 @@ namespace OpenRA.Traits
|
|||||||
public interface INotifyHarvest { void Harvested(Actor self, ResourceType resource); }
|
public interface INotifyHarvest { void Harvested(Actor self, ResourceType resource); }
|
||||||
|
|
||||||
public interface IAcceptInfiltrator { void OnInfiltrate(Actor self, Actor infiltrator); }
|
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 IStoreOre { int Capacity { get; } }
|
||||||
public interface IToolTip
|
public interface IToolTip
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,8 +41,12 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
|
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
|
||||||
.Select(t => t.GetDamageModifier(self, null)).Product();
|
.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)
|
if (modifier > 0)
|
||||||
target.Actor.Kill(self);
|
demolishable.Demolish(target.Actor, self);
|
||||||
})));
|
})));
|
||||||
|
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|||||||
@@ -288,5 +288,13 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
return damage;
|
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); }
|
public object Create(ActorInitializer init) { return new BridgeHut(init); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class BridgeHut
|
class BridgeHut : IDemolishable
|
||||||
{
|
{
|
||||||
public Bridge bridge;
|
public Bridge bridge;
|
||||||
|
|
||||||
@@ -31,6 +31,16 @@ namespace OpenRA.Mods.RA
|
|||||||
bridge.Repair(repairer, true, true);
|
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(); } }
|
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)
|
if (target.Type != TargetType.Actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var demolishable = order.TargetActor.TraitOrDefault<IDemolishable>();
|
||||||
|
if (demolishable == null || !demolishable.IsValidTarget(target.Actor, self))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!order.Queued)
|
if (!order.Queued)
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|
||||||
|
|||||||
@@ -125,12 +125,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
startJeep.QueueActivity(new Turn(128));
|
startJeep.QueueActivity(new Turn(128));
|
||||||
startJeep.QueueActivity(new CallFunc(() =>
|
startJeep.QueueActivity(new CallFunc(() =>
|
||||||
{
|
{
|
||||||
var bridge = world.Actors
|
var bridge = world.Actors.Where(a => a.HasTrait<BridgeHut>()).ClosestTo(startJeep);
|
||||||
.Where(a => a.HasTrait<Bridge>() && !a.IsDead())
|
bridge.Trait<BridgeHut>().Demolish(bridge, startJeep);
|
||||||
.ClosestTo(startJeep);
|
|
||||||
Combat.DoExplosion(bridge, "Demolish", bridge.CenterPosition);
|
|
||||||
world.WorldActor.Trait<ScreenShaker>().AddEffect(15, bridge.CenterPosition, 6);
|
|
||||||
bridge.Kill(bridge);
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -484,6 +484,7 @@
|
|||||||
<Compile Include="Effects\Rank.cs" />
|
<Compile Include="Effects\Rank.cs" />
|
||||||
<Compile Include="ShroudRenderer.cs" />
|
<Compile Include="ShroudRenderer.cs" />
|
||||||
<Compile Include="Render\WithCrateBody.cs" />
|
<Compile Include="Render\WithCrateBody.cs" />
|
||||||
|
<Compile Include="Buildings\Demolishable.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ BRIDGEHUT:
|
|||||||
Bounds: 48,48
|
Bounds: 48,48
|
||||||
BridgeHut:
|
BridgeHut:
|
||||||
TargetableBuilding:
|
TargetableBuilding:
|
||||||
TargetTypes: BridgeHut
|
TargetTypes: BridgeHut, C4
|
||||||
|
|
||||||
C1:
|
C1:
|
||||||
Inherits: ^CivInfantry
|
Inherits: ^CivInfantry
|
||||||
@@ -455,4 +455,3 @@ VICE:
|
|||||||
QuantizedFacings: 8
|
QuantizedFacings: 8
|
||||||
PoisonedByTiberium:
|
PoisonedByTiberium:
|
||||||
Weapon: Heal
|
Weapon: Heal
|
||||||
|
|
||||||
|
|||||||
@@ -353,6 +353,7 @@
|
|||||||
EngineerRepairable:
|
EngineerRepairable:
|
||||||
Huntable:
|
Huntable:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
Demolishable:
|
||||||
|
|
||||||
^CivBuilding:
|
^CivBuilding:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
@@ -456,6 +457,7 @@
|
|||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
Demolishable:
|
||||||
|
|
||||||
^Tree:
|
^Tree:
|
||||||
Tooltip:
|
Tooltip:
|
||||||
|
|||||||
@@ -1027,3 +1027,7 @@ Claw:
|
|||||||
InfDeath: 1
|
InfDeath: 1
|
||||||
Damage: 60
|
Damage: 60
|
||||||
|
|
||||||
|
Demolish:
|
||||||
|
Warhead:
|
||||||
|
ImpactSound: xplobig6.aud
|
||||||
|
Explosion: building
|
||||||
@@ -249,4 +249,4 @@
|
|||||||
WithCrumbleOverlay:
|
WithCrumbleOverlay:
|
||||||
Huntable:
|
Huntable:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
Demolishable:
|
||||||
|
|||||||
@@ -384,6 +384,7 @@
|
|||||||
Sellable:
|
Sellable:
|
||||||
Guardable:
|
Guardable:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
|
Demolishable:
|
||||||
|
|
||||||
WALL:
|
WALL:
|
||||||
Inherits: ^WALL
|
Inherits: ^WALL
|
||||||
|
|||||||
@@ -488,7 +488,7 @@ BRIDGEHUT:
|
|||||||
Bounds: 48,48
|
Bounds: 48,48
|
||||||
BridgeHut:
|
BridgeHut:
|
||||||
TargetableBuilding:
|
TargetableBuilding:
|
||||||
TargetTypes: BridgeHut
|
TargetTypes: BridgeHut, C4
|
||||||
|
|
||||||
BRIDGEHUT.small:
|
BRIDGEHUT.small:
|
||||||
Building:
|
Building:
|
||||||
@@ -499,7 +499,7 @@ BRIDGEHUT.small:
|
|||||||
Bounds: 24,24
|
Bounds: 24,24
|
||||||
BridgeHut:
|
BridgeHut:
|
||||||
TargetableBuilding:
|
TargetableBuilding:
|
||||||
TargetTypes: BridgeHut
|
TargetTypes: BridgeHut, C4
|
||||||
|
|
||||||
V20:
|
V20:
|
||||||
Inherits: ^DesertCivBuilding
|
Inherits: ^DesertCivBuilding
|
||||||
|
|||||||
@@ -264,6 +264,7 @@
|
|||||||
String: Structure
|
String: Structure
|
||||||
Huntable:
|
Huntable:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
Demolishable:
|
||||||
|
|
||||||
^Wall:
|
^Wall:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -300,6 +301,7 @@
|
|||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
Demolishable:
|
||||||
|
|
||||||
^TechBuilding:
|
^TechBuilding:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
Huntable:
|
Huntable:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
Demolishable:
|
||||||
|
|
||||||
^Infantry:
|
^Infantry:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
@@ -176,6 +177,7 @@
|
|||||||
UpdatesPlayerStatistics:
|
UpdatesPlayerStatistics:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
Demolishable:
|
||||||
|
|
||||||
^Helicopter:
|
^Helicopter:
|
||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
|
|||||||
Reference in New Issue
Block a user