Added demo truck to soviet's arensal; still problems to fix
This commit is contained in:
committed by
Chris Forbes
parent
61e548151b
commit
34d96878b8
@@ -8,44 +8,63 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Mods.RA.Activities;
|
||||
using OpenRA.Mods.RA.Buildings;
|
||||
using OpenRA.Mods.RA.Orders;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
class DemoTruckInfo : TraitInfo<DemoTruck> { }
|
||||
// Requiring Explodes is busted.
|
||||
// Exception when overriding Chronoshift event; removed for now, will look into it.
|
||||
class DemoTruckInfo : TraitInfo<DemoTruck> {} //, Requires<Explodes> {}
|
||||
|
||||
class DemoTruck : Chronoshiftable, INotifyKilled
|
||||
class DemoTruck : IIssueOrder, IResolveOrder, IOrderVoice
|
||||
{
|
||||
// Explode on chronoshift
|
||||
public override bool Teleport(Actor self, CPos targetLocation, int duration, bool killCargo, Actor chronosphere)
|
||||
void Explode(Actor self)
|
||||
{
|
||||
Detonate(self, chronosphere);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fire primary on death
|
||||
public void Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
Detonate(self, e.Attacker);
|
||||
}
|
||||
|
||||
public void Detonate(Actor self, Actor detonatedBy)
|
||||
{
|
||||
var move = self.TraitOrDefault<IMove>();
|
||||
var info = self.Info.Traits.Get<AttackBaseInfo>();
|
||||
var altitude = move != null ? move.Altitude : 0;
|
||||
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
if (self.Destroyed) return;
|
||||
Combat.DoExplosion(self, info.PrimaryWeapon, self.CenterLocation, altitude);
|
||||
|
||||
// Remove from world
|
||||
self.Kill(self);
|
||||
detonatedBy.Owner.Kills++;
|
||||
self.Owner.Deaths++;
|
||||
self.Destroy();
|
||||
self.InflictDamage(self, int.MaxValue, null);
|
||||
});
|
||||
}
|
||||
|
||||
public IEnumerable<IOrderTargeter> Orders
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return new UnitTraitOrderTargeter<Building>("DemoAttack", 5, "attack", true, false) { ForceAttack = false };
|
||||
yield return new DeployOrderTargeter("DemoDeploy", 5);
|
||||
}
|
||||
}
|
||||
|
||||
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
|
||||
{
|
||||
if (order.OrderID == "DemoAttack" || order.OrderID == "DemoDeploy")
|
||||
return new Order(order.OrderID, self, queued) { TargetActor = target.Actor };
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public string VoicePhraseForOrder(Actor self, Order order)
|
||||
{
|
||||
return "Attack";
|
||||
}
|
||||
|
||||
public void ResolveOrder(Actor self, Order order)
|
||||
{
|
||||
if (order.OrderString == "DemoDeploy")
|
||||
{
|
||||
self.World.AddFrameEndTask(w =>
|
||||
{
|
||||
self.QueueActivity(new MoveAdjacentTo(Target.FromOrder(order)));
|
||||
self.QueueActivity(new CallFunc(() => Explode(self)));
|
||||
});
|
||||
}
|
||||
if (order.OrderString == "DemoAttack")
|
||||
Explode(self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
mods/ra/bits/dtrk.shp
Normal file
BIN
mods/ra/bits/dtrk.shp
Normal file
Binary file not shown.
BIN
mods/ra/bits/dtrkicon.shp
Normal file
BIN
mods/ra/bits/dtrkicon.shp
Normal file
Binary file not shown.
@@ -514,6 +514,7 @@ TTNK:
|
||||
Inherits: ^Tank
|
||||
Buildable:
|
||||
Queue: Vehicle
|
||||
BuildPaletteOrder: 130
|
||||
Prerequisites: stek,tsla
|
||||
Owner: soviet
|
||||
Valued:
|
||||
@@ -571,3 +572,33 @@ FTRK:
|
||||
EmptyWeapon: UnitExplodeSmall
|
||||
Selectable:
|
||||
Bounds: 28,28,0,0
|
||||
|
||||
DTRK:
|
||||
Inherits: ^Vehicle
|
||||
Buildable:
|
||||
Queue: Vehicle
|
||||
BuildPaletteOrder: 140
|
||||
Prerequisites: stek
|
||||
Owner: soviet
|
||||
Valued:
|
||||
Cost: 1500
|
||||
Tooltip:
|
||||
Name: Demolition Truck
|
||||
Description: Demolition Truck, actively armed with explosives.\n Strong vs Everything,\n Weak vs Everything
|
||||
Health:
|
||||
HP: 110
|
||||
Armor:
|
||||
Type: Light
|
||||
Mobile:
|
||||
Speed: 8
|
||||
RevealsShroud:
|
||||
Range: 3
|
||||
RenderUnit:
|
||||
AttackMove:
|
||||
JustMove: yes
|
||||
Explodes:
|
||||
Weapon: Atomic
|
||||
EmptyWeapon: Atomic
|
||||
DemoTruck:
|
||||
-IronCurtainable:
|
||||
-Chronoshiftable:
|
||||
|
||||
@@ -2268,3 +2268,8 @@ e8:
|
||||
die6: electro
|
||||
Start: 0
|
||||
Length: *
|
||||
|
||||
dtrk:
|
||||
idle:
|
||||
Start: 0
|
||||
Facings: 32
|
||||
Reference in New Issue
Block a user