Make Infiltrates grant player experience
This commit is contained in:
@@ -21,13 +21,15 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
readonly Stance validStances;
|
readonly Stance validStances;
|
||||||
readonly Cloak cloak;
|
readonly Cloak cloak;
|
||||||
readonly string notification;
|
readonly string notification;
|
||||||
|
readonly int experience;
|
||||||
|
|
||||||
public Infiltrate(Actor self, Actor target, EnterBehaviour enterBehaviour, Stance validStances, string notification)
|
public Infiltrate(Actor self, Actor target, EnterBehaviour enterBehaviour, Stance validStances, string notification, int experience)
|
||||||
: base(self, target, enterBehaviour)
|
: base(self, target, enterBehaviour)
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.validStances = validStances;
|
this.validStances = validStances;
|
||||||
this.notification = notification;
|
this.notification = notification;
|
||||||
|
this.experience = experience;
|
||||||
cloak = self.TraitOrDefault<Cloak>();
|
cloak = self.TraitOrDefault<Cloak>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,6 +48,10 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
foreach (var t in target.TraitsImplementing<INotifyInfiltrated>())
|
foreach (var t in target.TraitsImplementing<INotifyInfiltrated>())
|
||||||
t.Infiltrated(target, self);
|
t.Infiltrated(target, self);
|
||||||
|
|
||||||
|
var exp = self.Owner.PlayerActor.TraitOrDefault<PlayerExperience>();
|
||||||
|
if (exp != null)
|
||||||
|
exp.GiveExperience(experience);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(notification))
|
if (!string.IsNullOrEmpty(notification))
|
||||||
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech",
|
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech",
|
||||||
notification, self.Owner.Faction.InternalName);
|
notification, self.Owner.Faction.InternalName);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.RA.Scripting
|
|||||||
[Desc("Infiltrate the target actor.")]
|
[Desc("Infiltrate the target actor.")]
|
||||||
public void Infiltrate(Actor target)
|
public void Infiltrate(Actor target)
|
||||||
{
|
{
|
||||||
Self.QueueActivity(new Infiltrate(Self, target, info.EnterBehaviour, info.ValidStances, info.Notification));
|
Self.QueueActivity(new Infiltrate(Self, target, info.EnterBehaviour, info.ValidStances, info.Notification, info.PlayerExperience));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
[Desc("Notification to play when a building is infiltrated.")]
|
[Desc("Notification to play when a building is infiltrated.")]
|
||||||
public readonly string Notification = "BuildingInfiltrated";
|
public readonly string Notification = "BuildingInfiltrated";
|
||||||
|
|
||||||
|
[Desc("Experience to grant to the infiltrating player.")]
|
||||||
|
public readonly int PlayerExperience = 0;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Infiltrates(this); }
|
public object Create(ActorInitializer init) { return new Infiltrates(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +115,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|
||||||
self.SetTargetLine(target, Color.Red);
|
self.SetTargetLine(target, Color.Red);
|
||||||
self.QueueActivity(new Infiltrate(self, target.Actor, info.EnterBehaviour, info.ValidStances, info.Notification));
|
self.QueueActivity(new Infiltrate(self, target.Actor, info.EnterBehaviour, info.ValidStances, info.Notification, info.PlayerExperience));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user