Created
July 14, 2014 00:24
-
-
Save phrohdoh/4fa29e2ee0d2e04954b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParadropOrderTargeter : IOrderTargeter | |
{ | |
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor) | |
{ | |
if (target.Type != TargetType.Terrain) | |
return false; | |
var location = self.World.Map.CellContaining(target.CenterPosition); | |
if (!self.World.Map.Contains(location)) | |
return false; | |
// No passengers can unload here | |
if (!self.Trait<ParaDrop>().Cargo.Passengers | |
.Any(p => p.Trait<IPositionable>().CanEnterCell(location))) | |
{ | |
Game.Debug("No passengers can exist at {0}".F(location.ToString())); | |
return false; | |
} | |
cursor = "attack"; | |
return !othersAtTarget.Any() && modifiers.HasModifier(TargetModifiers.ForceAttack); | |
} | |
public string OrderID { get { return "CustomParadrop"; } } | |
public int OrderPriority { get { return 5; } } | |
public bool IsQueued { get { return false; } } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment