Add DamageTypes to Kill() and make some traits use it.

This commit is contained in:
Mustafa Alperen Seki
2018-02-03 11:07:02 +03:00
committed by reaperrr
parent b620e8107f
commit 5e7e3bb011
17 changed files with 58 additions and 22 deletions

View File

@@ -10,6 +10,7 @@
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Activities;
using OpenRA.GameRules;
@@ -29,8 +30,9 @@ namespace OpenRA.Mods.Cnc.Activities
WPos to;
int ticks;
WAngle angle;
HashSet<string> damageTypes;
public Leap(Actor self, Actor target, Armament a, WDist speed, WAngle angle)
public Leap(Actor self, Actor target, Armament a, WDist speed, WAngle angle, HashSet<string> damageTypes)
{
var targetMobile = target.TraitOrDefault<Mobile>();
if (targetMobile == null)
@@ -38,6 +40,7 @@ namespace OpenRA.Mods.Cnc.Activities
this.weapon = a.Weapon;
this.angle = angle;
this.damageTypes = damageTypes;
mobile = self.Trait<Mobile>();
mobile.SetLocation(mobile.FromCell, mobile.FromSubCell, targetMobile.FromCell, targetMobile.FromSubCell);
mobile.IsMoving = true;
@@ -67,7 +70,7 @@ namespace OpenRA.Mods.Cnc.Activities
self.World.ActorMap.GetActorsAt(mobile.ToCell, mobile.ToSubCell)
.Except(new[] { self }).Where(t => weapon.IsValidAgainst(t, self))
.Do(t => t.Kill(self));
.Do(t => t.Kill(self, damageTypes));
return NextActivity;
}