Add hijackable truck to Allies 04
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Activities
|
namespace OpenRA.Mods.RA.Activities
|
||||||
@@ -30,8 +31,16 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
foreach (var t in target.TraitsImplementing<IAcceptSpy>())
|
foreach (var t in target.TraitsImplementing<IAcceptSpy>())
|
||||||
t.OnInfiltrate(target, self);
|
t.OnInfiltrate(target, self);
|
||||||
|
|
||||||
|
if (self.HasTrait<DontDestroyWhenInfiltrating>())
|
||||||
|
self.World.AddFrameEndTask(w =>
|
||||||
|
{
|
||||||
|
if (self.Destroyed) return;
|
||||||
|
w.Remove(self);
|
||||||
|
});
|
||||||
|
else
|
||||||
self.Destroy();
|
self.Destroy();
|
||||||
|
|
||||||
|
if (target.HasTrait<Building>())
|
||||||
Sound.PlayToPlayer(self.Owner, "bldginf1.aud");
|
Sound.PlayToPlayer(self.Owner, "bldginf1.aud");
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
|
using OpenRA.Mods.RA.Render;
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -36,6 +37,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
Actor lstEntryPoint;
|
Actor lstEntryPoint;
|
||||||
Actor lstUnloadPoint;
|
Actor lstUnloadPoint;
|
||||||
Actor lstExitPoint;
|
Actor lstExitPoint;
|
||||||
|
Actor hijackTruck;
|
||||||
|
Actor hijackTruckGuard;
|
||||||
|
|
||||||
Actor allies1Spy;
|
Actor allies1Spy;
|
||||||
Actor allies2Spy;
|
Actor allies2Spy;
|
||||||
@@ -76,6 +79,14 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
PatrolTick(ref patrol3, ref currentPatrolPoint3, soviets, DogPatrol, patrolPoints3);
|
PatrolTick(ref patrol3, ref currentPatrolPoint3, soviets, DogPatrol, patrolPoints3);
|
||||||
PatrolTick(ref patrol4, ref currentPatrolPoint4, soviets, DogPatrol, patrolPoints4);
|
PatrolTick(ref patrol4, ref currentPatrolPoint4, soviets, DogPatrol, patrolPoints4);
|
||||||
PatrolTick(ref patrol5, ref currentPatrolPoint5, soviets, DogPatrol, patrolPoints5);
|
PatrolTick(ref patrol5, ref currentPatrolPoint5, soviets, DogPatrol, patrolPoints5);
|
||||||
|
ManageSovietOre();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ManageSovietOre()
|
||||||
|
{
|
||||||
|
var res = soviets.PlayerActor.Trait<PlayerResources>();
|
||||||
|
res.TakeOre(res.Ore);
|
||||||
|
res.TakeCash(res.Cash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PatrolTick(ref Actor[] patrolActors, ref int currentPoint, Player owner, string[] actorNames, CPos[] points)
|
void PatrolTick(ref Actor[] patrolActors, ref int currentPoint, Player owner, string[] actorNames, CPos[] points)
|
||||||
@@ -151,6 +162,8 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
lstEntryPoint = actors["LstEntryPoint"];
|
lstEntryPoint = actors["LstEntryPoint"];
|
||||||
lstUnloadPoint = actors["LstUnloadPoint"];
|
lstUnloadPoint = actors["LstUnloadPoint"];
|
||||||
lstExitPoint = actors["LstExitPoint"];
|
lstExitPoint = actors["LstExitPoint"];
|
||||||
|
hijackTruck = actors["HijackTruck"];
|
||||||
|
hijackTruckGuard = actors["HijackTruckGuard"];
|
||||||
patrolPoints1 = new[]
|
patrolPoints1 = new[]
|
||||||
{
|
{
|
||||||
actors["PatrolPoint11"].Location,
|
actors["PatrolPoint11"].Location,
|
||||||
@@ -208,4 +221,58 @@ namespace OpenRA.Mods.RA.Missions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Allies04HijackableInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public object Create(ActorInitializer init) { return new Allies04Hijackable(init.self); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Allies04Hijackable : IAcceptSpy, INotifyPassengerExited
|
||||||
|
{
|
||||||
|
public Player OldOwner;
|
||||||
|
|
||||||
|
public Allies04Hijackable(Actor self)
|
||||||
|
{
|
||||||
|
OldOwner = self.Owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnInfiltrate(Actor self, Actor spy)
|
||||||
|
{
|
||||||
|
if (self.Trait<Cargo>().IsEmpty(self))
|
||||||
|
{
|
||||||
|
self.ChangeOwner(spy.Owner);
|
||||||
|
}
|
||||||
|
self.Trait<Cargo>().Load(self, spy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PassengerExited(Actor self, Actor passenger)
|
||||||
|
{
|
||||||
|
if (self.Trait<Cargo>().IsEmpty(self))
|
||||||
|
{
|
||||||
|
self.CancelActivity();
|
||||||
|
self.ChangeOwner(OldOwner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Allies04RenderHijackedInfo : RenderUnitInfo
|
||||||
|
{
|
||||||
|
public override object Create(ActorInitializer init) { return new Allies04RenderHijacked(init.self, this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Allies04RenderHijacked : RenderUnit, IRenderModifier
|
||||||
|
{
|
||||||
|
Allies04Hijackable hijackable;
|
||||||
|
|
||||||
|
public Allies04RenderHijacked(Actor self, Allies04RenderHijackedInfo info)
|
||||||
|
: base(self)
|
||||||
|
{
|
||||||
|
hijackable = self.Trait<Allies04Hijackable>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||||
|
{
|
||||||
|
return r.Select(a => a.WithPalette(Palette(hijackable.OldOwner)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
@@ -155,4 +155,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
class IgnoresDisguiseInfo : TraitInfo<IgnoresDisguise> {}
|
class IgnoresDisguiseInfo : TraitInfo<IgnoresDisguise> {}
|
||||||
class IgnoresDisguise {}
|
class IgnoresDisguise {}
|
||||||
|
|
||||||
|
class DontDestroyWhenInfiltratingInfo : TraitInfo<DontDestroyWhenInfiltrating> { }
|
||||||
|
class DontDestroyWhenInfiltrating { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ Actors:
|
|||||||
Actor136: dome
|
Actor136: dome
|
||||||
Location: 107,25
|
Location: 107,25
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor137: weap
|
HijackFactory: weap
|
||||||
Location: 98,32
|
Location: 98,32
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor138: sam
|
Actor138: sam
|
||||||
@@ -768,7 +768,7 @@ Actors:
|
|||||||
Actor229: v2rl
|
Actor229: v2rl
|
||||||
Location: 96,19
|
Location: 96,19
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor230: e1
|
HijackTruckGuard: e1
|
||||||
Location: 65,34
|
Location: 65,34
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
Actor50: fenc
|
Actor50: fenc
|
||||||
@@ -852,6 +852,7 @@ Actors:
|
|||||||
Actor264: v2rl
|
Actor264: v2rl
|
||||||
Location: 50,36
|
Location: 50,36
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
|
Facing: 192
|
||||||
Actor266: 3tnk
|
Actor266: 3tnk
|
||||||
Location: 88,70
|
Location: 88,70
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
@@ -1263,6 +1264,7 @@ Actors:
|
|||||||
Actor328: v2rl
|
Actor328: v2rl
|
||||||
Location: 27,37
|
Location: 27,37
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
|
Facing: 64
|
||||||
Actor366: powr
|
Actor366: powr
|
||||||
Location: 35,54
|
Location: 35,54
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
@@ -1413,6 +1415,10 @@ Actors:
|
|||||||
Actor427: dog
|
Actor427: dog
|
||||||
Location: 104,24
|
Location: 104,24
|
||||||
Owner: Soviets
|
Owner: Soviets
|
||||||
|
HijackTruck: truk.hijackable
|
||||||
|
Location: 99,34
|
||||||
|
Owner: Soviets
|
||||||
|
Facing: 160
|
||||||
|
|
||||||
Smudges:
|
Smudges:
|
||||||
|
|
||||||
@@ -1433,13 +1439,13 @@ Rules:
|
|||||||
Range: 10
|
Range: 10
|
||||||
Health:
|
Health:
|
||||||
HP: 100
|
HP: 100
|
||||||
|
DontDestroyWhenInfiltrating:
|
||||||
DOG.Patrol:
|
DOG.Patrol:
|
||||||
Inherits: ^Infantry
|
Inherits: ^Infantry
|
||||||
Valued:
|
Valued:
|
||||||
Cost: 200
|
Cost: 200
|
||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Attack Dog
|
Name: Attack Dog
|
||||||
Description: Anti-infantry unit. Not fooled by the \nSpy's disguise.\n Strong vs Infantry\n Weak vs Vehicles
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Voice: DogVoice
|
Voice: DogVoice
|
||||||
Bounds: 12,17,-1,-4
|
Bounds: 12,17,-1,-4
|
||||||
@@ -1457,9 +1463,37 @@ Rules:
|
|||||||
Image: dog
|
Image: dog
|
||||||
IdleAnimations: idle1,idle2
|
IdleAnimations: idle1,idle2
|
||||||
IgnoresDisguise:
|
IgnoresDisguise:
|
||||||
|
TRUK.Hijackable:
|
||||||
|
Inherits: ^Vehicle
|
||||||
|
Cargo:
|
||||||
|
MaxWeight: 2
|
||||||
|
PipCount: 2
|
||||||
|
AutoTargetIgnore:
|
||||||
|
Allies04Hijackable:
|
||||||
|
Allies04RenderHijacked:
|
||||||
|
Image: TRUK
|
||||||
|
Selectable:
|
||||||
|
Voice: SpyVoice
|
||||||
|
Valued:
|
||||||
|
Cost: 500
|
||||||
|
Tooltip:
|
||||||
|
Name: Supply Truck
|
||||||
|
Health:
|
||||||
|
HP: 110
|
||||||
|
Armor:
|
||||||
|
Type: Light
|
||||||
|
Mobile:
|
||||||
|
Speed: 9
|
||||||
|
RevealsShroud:
|
||||||
|
Range: 10
|
||||||
|
AttackMove:
|
||||||
|
JustMove: yes
|
||||||
|
|
||||||
Sequences:
|
Sequences:
|
||||||
|
truk:
|
||||||
|
unload:
|
||||||
|
Start: 0
|
||||||
|
Facings: 32
|
||||||
Weapons:
|
Weapons:
|
||||||
|
|
||||||
Voices:
|
Voices:
|
||||||
|
|||||||
Reference in New Issue
Block a user