Introduce WarheadArgs

- Passes additional arguments to warheads on impact
- Uses that to reduce parameter count of DoImpact by 1
This commit is contained in:
reaperrr
2019-05-12 23:29:35 +02:00
committed by teinarss
parent fdc0a6e2b9
commit 6220d7e62e
31 changed files with 127 additions and 44 deletions

View File

@@ -11,6 +11,7 @@
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
@@ -25,11 +26,12 @@ namespace OpenRA.Mods.Common.Warheads
public readonly string AddsResourceType = null;
// TODO: Allow maximum resource splatter to be defined. (Per tile, and in total).
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
public override void DoImpact(Target target, WarheadArgs args)
{
if (string.IsNullOrEmpty(AddsResourceType))
return;
var firedBy = args.SourceActor;
var world = firedBy.World;
var targetTile = world.Map.CellContaining(target.CenterPosition);
var resLayer = world.WorldActor.Trait<ResourceLayer>();