1 #region Copyright & License Information 2 /* 3 * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) 4 * This file is part of OpenRA, which is free software. It is made 5 * available to you under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, either version 3 of 7 * the License, or (at your option) any later version. For more 8 * information, see COPYING. 9 */ 10 #endregion 11 12 using System; 13 using System.Collections.Generic; 14 using OpenRA.Activities; 15 using OpenRA.Graphics; 16 using OpenRA.Mods.Common.Activities; 17 using OpenRA.Mods.Common.Graphics; 18 using OpenRA.Primitives; 19 using OpenRA.Traits; 20 21 namespace OpenRA.Mods.Common.Traits 22 { 23 public enum VisibilityType { Footprint, CenterPosition, GroundPosition } 24 25 public enum AttackDelayType { Preparation, Attack } 26 27 [Flags] 28 public enum ResupplyType 29 { 30 None = 0, 31 Rearm = 1, 32 Repair = 2 33 } 34 35 public interface IQuantizeBodyOrientationInfo : ITraitInfo 36 { QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race)37 int QuantizedBodyFacings(ActorInfo ai, SequenceProvider sequenceProvider, string race); 38 } 39 40 public interface IPlaceBuildingDecorationInfo : ITraitInfo 41 { RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)42 IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition); 43 } 44 45 [RequireExplicitImplementation] 46 public interface IBlocksProjectiles 47 { 48 WDist BlockingHeight { get; } 49 } 50 51 [RequireExplicitImplementation] 52 public interface IBlocksProjectilesInfo : ITraitInfoInterface { } 53 54 [RequireExplicitImplementation] 55 public interface INotifySold 56 { Selling(Actor self)57 void Selling(Actor self); Sold(Actor self)58 void Sold(Actor self); 59 } 60 61 [RequireExplicitImplementation] 62 public interface INotifyCustomLayerChanged 63 { CustomLayerChanged(Actor self, byte oldLayer, byte newLayer)64 void CustomLayerChanged(Actor self, byte oldLayer, byte newLayer); 65 } 66 67 [RequireExplicitImplementation] 68 public interface INotifyVisualPositionChanged 69 { VisualPositionChanged(Actor self, byte oldLayer, byte newLayer)70 void VisualPositionChanged(Actor self, byte oldLayer, byte newLayer); 71 } 72 73 [RequireExplicitImplementation] 74 public interface INotifyFinishedMoving 75 { FinishedMoving(Actor self, byte oldLayer, byte newLayer)76 void FinishedMoving(Actor self, byte oldLayer, byte newLayer); 77 } 78 IsValidTarget(ActorInfo actorInfo, Actor saboteur)79 public interface IDemolishableInfo : ITraitInfoInterface { bool IsValidTarget(ActorInfo actorInfo, Actor saboteur); } 80 public interface IDemolishable 81 { IsValidTarget(Actor self, Actor saboteur)82 bool IsValidTarget(Actor self, Actor saboteur); Demolish(Actor self, Actor saboteur, int delay)83 void Demolish(Actor self, Actor saboteur, int delay); 84 } 85 86 // Type tag for crush class bits 87 public class CrushClass { } 88 89 [RequireExplicitImplementation] 90 public interface ICrushable 91 { CrushableBy(Actor self, Actor crusher, BitSet<CrushClass> crushClasses)92 bool CrushableBy(Actor self, Actor crusher, BitSet<CrushClass> crushClasses); CrushableBy(Actor self, BitSet<CrushClass> crushClasses)93 LongBitSet<PlayerBitMask> CrushableBy(Actor self, BitSet<CrushClass> crushClasses); 94 } 95 96 [RequireExplicitImplementation] 97 public interface INotifyCrushed 98 { OnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses)99 void OnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses); WarnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses)100 void WarnCrush(Actor self, Actor crusher, BitSet<CrushClass> crushClasses); 101 } 102 103 [RequireExplicitImplementation] 104 public interface INotifyAiming 105 { StartedAiming(Actor self, AttackBase attack)106 void StartedAiming(Actor self, AttackBase attack); StoppedAiming(Actor self, AttackBase attack)107 void StoppedAiming(Actor self, AttackBase attack); 108 } 109 110 [RequireExplicitImplementation] 111 public interface INotifyAttack 112 { Attacking(Actor self, Target target, Armament a, Barrel barrel)113 void Attacking(Actor self, Target target, Armament a, Barrel barrel); PreparingAttack(Actor self, Target target, Armament a, Barrel barrel)114 void PreparingAttack(Actor self, Target target, Armament a, Barrel barrel); 115 } 116 117 [RequireExplicitImplementation] DamageStateChanged(Actor self, AttackInfo e)118 public interface INotifyDamageStateChanged { void DamageStateChanged(Actor self, AttackInfo e); } 119 120 [RequireExplicitImplementation] Damaged(Actor self, AttackInfo e)121 public interface INotifyDamage { void Damaged(Actor self, AttackInfo e); } 122 [RequireExplicitImplementation] Killed(Actor self, AttackInfo e)123 public interface INotifyKilled { void Killed(Actor self, AttackInfo e); } 124 [RequireExplicitImplementation] AppliedDamage(Actor self, Actor damaged, AttackInfo e)125 public interface INotifyAppliedDamage { void AppliedDamage(Actor self, Actor damaged, AttackInfo e); } 126 127 [RequireExplicitImplementation] 128 public interface INotifyResupply 129 { BeforeResupply(Actor host, Actor target, ResupplyType types)130 void BeforeResupply(Actor host, Actor target, ResupplyType types); ResupplyTick(Actor host, Actor target, ResupplyType types)131 void ResupplyTick(Actor host, Actor target, ResupplyType types); 132 } 133 134 [RequireExplicitImplementation] PowerLevelChanged(Actor self)135 public interface INotifyPowerLevelChanged { void PowerLevelChanged(Actor self); } 136 BuildingPlaced(Actor self)137 public interface INotifyBuildingPlaced { void BuildingPlaced(Actor self); } Launching(Actor self)138 public interface INotifyNuke { void Launching(Actor self); } FiredBurst(Actor self, Target target, Armament a)139 public interface INotifyBurstComplete { void FiredBurst(Actor self, Target target, Armament a); } OnChat(string from, string message)140 public interface INotifyChat { bool OnChat(string from, string message); } UnitProduced(Actor self, Actor other, CPos exit)141 public interface INotifyProduction { void UnitProduced(Actor self, Actor other, CPos exit); } UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType, TypeDictionary init)142 public interface INotifyOtherProduction { void UnitProducedByOther(Actor self, Actor producer, Actor produced, string productionType, TypeDictionary init); } Delivered(Actor self)143 public interface INotifyDelivery { void IncomingDelivery(Actor self); void Delivered(Actor self); } Docked(Actor self, Actor harvester)144 public interface INotifyDocking { void Docked(Actor self, Actor harvester); void Undocked(Actor self, Actor harvester); } 145 146 [RequireExplicitImplementation] OnResourceAccepted(Actor self, Actor refinery, int amount)147 public interface INotifyResourceAccepted { void OnResourceAccepted(Actor self, Actor refinery, int amount); } OnParachute(Actor self)148 public interface INotifyParachute { void OnParachute(Actor self); void OnLanded(Actor self); } 149 150 [RequireExplicitImplementation] OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner, BitSet<CaptureType> captureTypes)151 public interface INotifyCapture { void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner, BitSet<CaptureType> captureTypes); } OnDiscovered(Actor self, Player discoverer, bool playNotification)152 public interface INotifyDiscovered { void OnDiscovered(Actor self, Player discoverer, bool playNotification); } RenderPreview(ActorPreviewInitializer init)153 public interface IRenderActorPreviewInfo : ITraitInfo { IEnumerable<IActorPreview> RenderPreview(ActorPreviewInitializer init); } GetCruiseAltitude()154 public interface ICruiseAltitudeInfo : ITraitInfo { WDist GetCruiseAltitude(); } 155 HuskActor(Actor self)156 public interface IHuskModifier { string HuskActor(Actor self); } 157 Seed(Actor self)158 public interface ISeedableResource { void Seed(Actor self); } 159 160 [RequireExplicitImplementation] Infiltrated(Actor self, Actor infiltrator, BitSet<TargetableType> types)161 public interface INotifyInfiltrated { void Infiltrated(Actor self, Actor infiltrator, BitSet<TargetableType> types); } 162 163 [RequireExplicitImplementation] OnNotifyBlockingMove(Actor self, Actor blocking)164 public interface INotifyBlockingMove { void OnNotifyBlockingMove(Actor self, Actor blocking); } 165 166 [RequireExplicitImplementation] OnPassengerEntered(Actor self, Actor passenger)167 public interface INotifyPassengerEntered { void OnPassengerEntered(Actor self, Actor passenger); } 168 169 [RequireExplicitImplementation] OnPassengerExited(Actor self, Actor passenger)170 public interface INotifyPassengerExited { void OnPassengerExited(Actor self, Actor passenger); } 171 172 [RequireExplicitImplementation] OnEnteredCargo(Actor self, Actor cargo)173 public interface INotifyEnteredCargo { void OnEnteredCargo(Actor self, Actor cargo); } 174 175 [RequireExplicitImplementation] OnExitedCargo(Actor self, Actor cargo)176 public interface INotifyExitedCargo { void OnExitedCargo(Actor self, Actor cargo); } 177 178 [RequireExplicitImplementation] 179 public interface IObservesVariablesInfo : ITraitInfo { } 180 VariableObserverNotifier(Actor self, IReadOnlyDictionary<string, int> variables)181 public delegate void VariableObserverNotifier(Actor self, IReadOnlyDictionary<string, int> variables); 182 public struct VariableObserver 183 { 184 public VariableObserverNotifier Notifier; 185 public IEnumerable<string> Variables; VariableObserverOpenRA.Mods.Common.Traits.VariableObserver186 public VariableObserver(VariableObserverNotifier notifier, IEnumerable<string> variables) 187 { 188 Notifier = notifier; 189 Variables = variables; 190 } 191 } 192 193 public interface IObservesVariables 194 { GetVariableObservers()195 IEnumerable<VariableObserver> GetVariableObservers(); 196 } 197 198 public interface INotifyHarvesterAction 199 { MovingToResources(Actor self, CPos targetCell)200 void MovingToResources(Actor self, CPos targetCell); MovingToRefinery(Actor self, Actor refineryActor)201 void MovingToRefinery(Actor self, Actor refineryActor); MovementCancelled(Actor self)202 void MovementCancelled(Actor self); Harvested(Actor self, ResourceType resource)203 void Harvested(Actor self, ResourceType resource); Docked()204 void Docked(); Undocked()205 void Undocked(); 206 } 207 208 [RequireExplicitImplementation] 209 public interface INotifyUnload 210 { Unloading(Actor self)211 void Unloading(Actor self); 212 } 213 214 [RequireExplicitImplementation] 215 public interface INotifyDemolition 216 { Demolishing(Actor self)217 void Demolishing(Actor self); 218 } 219 220 [RequireExplicitImplementation] 221 public interface INotifyInfiltration 222 { Infiltrating(Actor self)223 void Infiltrating(Actor self); 224 } 225 226 public interface ITechTreePrerequisiteInfo : ITraitInfo 227 { Prerequisites(ActorInfo info)228 IEnumerable<string> Prerequisites(ActorInfo info); 229 } 230 231 public interface ITechTreePrerequisite 232 { 233 IEnumerable<string> ProvidesPrerequisites { get; } 234 } 235 236 public interface ITechTreeElement 237 { PrerequisitesAvailable(string key)238 void PrerequisitesAvailable(string key); PrerequisitesUnavailable(string key)239 void PrerequisitesUnavailable(string key); PrerequisitesItemHidden(string key)240 void PrerequisitesItemHidden(string key); PrerequisitesItemVisible(string key)241 void PrerequisitesItemVisible(string key); 242 } 243 244 public interface IProductionIconOverlay 245 { 246 Sprite Sprite { get; } 247 string Palette { get; } Offset(float2 iconSize)248 float2 Offset(float2 iconSize); IsOverlayActive(ActorInfo ai)249 bool IsOverlayActive(ActorInfo ai); 250 } 251 252 public interface INotifyTransform 253 { BeforeTransform(Actor self)254 void BeforeTransform(Actor self); OnTransform(Actor self)255 void OnTransform(Actor self); AfterTransform(Actor toActor)256 void AfterTransform(Actor toActor); 257 } 258 259 public interface INotifyDeployComplete 260 { FinishedDeploy(Actor self)261 void FinishedDeploy(Actor self); FinishedUndeploy(Actor self)262 void FinishedUndeploy(Actor self); 263 } 264 265 public interface INotifyDeployTriggered 266 { Deploy(Actor self, bool skipMakeAnim)267 void Deploy(Actor self, bool skipMakeAnim); Undeploy(Actor self, bool skipMakeAnim)268 void Undeploy(Actor self, bool skipMakeAnim); 269 } 270 271 public interface IAcceptResourcesInfo : ITraitInfo { } 272 public interface IAcceptResources 273 { OnDock(Actor harv, DeliverResources dockOrder)274 void OnDock(Actor harv, DeliverResources dockOrder); GiveResource(int amount)275 void GiveResource(int amount); CanGiveResource(int amount)276 bool CanGiveResource(int amount); 277 CVec DeliveryOffset { get; } 278 bool AllowDocking { get; } 279 } 280 281 public interface IProvidesAssetBrowserPalettes 282 { 283 IEnumerable<string> PaletteNames { get; } 284 } 285 286 public interface ICallForTransport 287 { 288 WDist MinimumDistance { get; } 289 bool WantsTransport { get; } MovementCancelled(Actor self)290 void MovementCancelled(Actor self); RequestTransport(Actor self, CPos destination)291 void RequestTransport(Actor self, CPos destination); 292 } 293 294 public interface IDeathActorInitModifier 295 { ModifyDeathActorInit(Actor self, TypeDictionary init)296 void ModifyDeathActorInit(Actor self, TypeDictionary init); 297 } 298 299 public interface ITransformActorInitModifier 300 { ModifyTransformActorInit(Actor self, TypeDictionary init)301 void ModifyTransformActorInit(Actor self, TypeDictionary init); 302 } 303 304 [RequireExplicitImplementation] 305 public interface IDisableEnemyAutoTarget 306 { DisableEnemyAutoTarget(Actor self, Actor attacker)307 bool DisableEnemyAutoTarget(Actor self, Actor attacker); 308 } 309 310 [RequireExplicitImplementation] 311 public interface IDisableAutoTarget 312 { DisableAutoTarget(Actor self)313 bool DisableAutoTarget(Actor self); 314 } 315 316 [RequireExplicitImplementation] 317 interface IWallConnector 318 { AdjacentWallCanConnect(Actor self, CPos wallLocation, string wallType, out CVec facing)319 bool AdjacentWallCanConnect(Actor self, CPos wallLocation, string wallType, out CVec facing); SetDirty()320 void SetDirty(); 321 } 322 323 [RequireExplicitImplementation] 324 public interface IActorPreviewInitModifier 325 { ModifyActorPreviewInit(Actor self, TypeDictionary inits)326 void ModifyActorPreviewInit(Actor self, TypeDictionary inits); 327 } 328 329 [RequireExplicitImplementation] 330 public interface INotifyRearm 331 { RearmingStarted(Actor host, Actor other)332 void RearmingStarted(Actor host, Actor other); Rearming(Actor host, Actor other)333 void Rearming(Actor host, Actor other); RearmingFinished(Actor host, Actor other)334 void RearmingFinished(Actor host, Actor other); 335 } 336 337 [RequireExplicitImplementation] 338 public interface IRenderInfantrySequenceModifier 339 { 340 bool IsModifyingSequence { get; } 341 string SequencePrefix { get; } 342 } 343 344 [RequireExplicitImplementation] GetProductionCostModifier(TechTree techTree, string queue)345 public interface IProductionCostModifierInfo : ITraitInfo { int GetProductionCostModifier(TechTree techTree, string queue); } 346 347 [RequireExplicitImplementation] GetProductionTimeModifier(TechTree techTree, string queue)348 public interface IProductionTimeModifierInfo : ITraitInfo { int GetProductionTimeModifier(TechTree techTree, string queue); } 349 350 [RequireExplicitImplementation] GetCashTricklerModifier()351 public interface ICashTricklerModifier { int GetCashTricklerModifier(); } 352 353 [RequireExplicitImplementation] GetDamageModifier(Actor attacker, Damage damage)354 public interface IDamageModifier { int GetDamageModifier(Actor attacker, Damage damage); } 355 356 [RequireExplicitImplementation] GetSpeedModifier()357 public interface ISpeedModifier { int GetSpeedModifier(); } 358 359 [RequireExplicitImplementation] GetFirepowerModifier()360 public interface IFirepowerModifier { int GetFirepowerModifier(); } 361 362 [RequireExplicitImplementation] GetReloadModifier()363 public interface IReloadModifier { int GetReloadModifier(); } 364 365 [RequireExplicitImplementation] GetReloadAmmoModifier()366 public interface IReloadAmmoModifier { int GetReloadAmmoModifier(); } 367 368 [RequireExplicitImplementation] GetInaccuracyModifier()369 public interface IInaccuracyModifier { int GetInaccuracyModifier(); } 370 371 [RequireExplicitImplementation] GetRangeModifier()372 public interface IRangeModifier { int GetRangeModifier(); } 373 374 [RequireExplicitImplementation] GetRangeModifierDefault()375 public interface IRangeModifierInfo : ITraitInfoInterface { int GetRangeModifierDefault(); } 376 377 [RequireExplicitImplementation] GetPowerModifier()378 public interface IPowerModifier { int GetPowerModifier(); } 379 380 [RequireExplicitImplementation] GetGivesExperienceModifier()381 public interface IGivesExperienceModifier { int GetGivesExperienceModifier(); } 382 383 [RequireExplicitImplementation] GetGainsExperienceModifier()384 public interface IGainsExperienceModifier { int GetGainsExperienceModifier(); } 385 386 [RequireExplicitImplementation] GetCreatesShroudModifier()387 public interface ICreatesShroudModifier { int GetCreatesShroudModifier(); } 388 389 [RequireExplicitImplementation] GetRevealsShroudModifier()390 public interface IRevealsShroudModifier { int GetRevealsShroudModifier(); } 391 392 [RequireExplicitImplementation] GetDetectCloakedModifier()393 public interface IDetectCloakedModifier { int GetDetectCloakedModifier(); } 394 395 [RequireExplicitImplementation] 396 public interface ICustomMovementLayer 397 { 398 byte Index { get; } 399 bool InteractsWithDefaultLayer { get; } 400 bool ReturnToGroundLayerOnIdle { get; } 401 EnabledForActor(ActorInfo a, LocomotorInfo li)402 bool EnabledForActor(ActorInfo a, LocomotorInfo li); EntryMovementCost(ActorInfo a, LocomotorInfo li, CPos cell)403 int EntryMovementCost(ActorInfo a, LocomotorInfo li, CPos cell); ExitMovementCost(ActorInfo a, LocomotorInfo li, CPos cell)404 int ExitMovementCost(ActorInfo a, LocomotorInfo li, CPos cell); 405 GetTerrainIndex(CPos cell)406 byte GetTerrainIndex(CPos cell); CenterOfCell(CPos cell)407 WPos CenterOfCell(CPos cell); 408 } 409 410 // For traits that want to be exposed to the "Deploy" UI button / hotkey 411 [RequireExplicitImplementation] 412 public interface IIssueDeployOrder 413 { IssueDeployOrder(Actor self, bool queued)414 Order IssueDeployOrder(Actor self, bool queued); CanIssueDeployOrder(Actor self, bool queued)415 bool CanIssueDeployOrder(Actor self, bool queued); 416 } 417 418 public enum ActorPreviewType { PlaceBuilding, ColorPicker, MapEditorSidebar } 419 420 [RequireExplicitImplementation] 421 public interface IActorPreviewInitInfo : ITraitInfo 422 { ActorPreviewInits(ActorInfo ai, ActorPreviewType type)423 IEnumerable<object> ActorPreviewInits(ActorInfo ai, ActorPreviewType type); 424 } 425 426 public interface IMove 427 { MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null, bool evaluateNearestMovableCell = false, Color? targetLineColor = null)428 Activity MoveTo(CPos cell, int nearEnough = 0, Actor ignoreActor = null, 429 bool evaluateNearestMovableCell = false, Color? targetLineColor = null); MoveWithinRange(Target target, WDist range, WPos? initialTargetPosition = null, Color? targetLineColor = null)430 Activity MoveWithinRange(Target target, WDist range, 431 WPos? initialTargetPosition = null, Color? targetLineColor = null); MoveWithinRange(Target target, WDist minRange, WDist maxRange, WPos? initialTargetPosition = null, Color? targetLineColor = null)432 Activity MoveWithinRange(Target target, WDist minRange, WDist maxRange, 433 WPos? initialTargetPosition = null, Color? targetLineColor = null); MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange, WPos? initialTargetPosition = null, Color? targetLineColor = null)434 Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange, 435 WPos? initialTargetPosition = null, Color? targetLineColor = null); MoveToTarget(Actor self, Target target, WPos? initialTargetPosition = null, Color? targetLineColor = null)436 Activity MoveToTarget(Actor self, Target target, 437 WPos? initialTargetPosition = null, Color? targetLineColor = null); ReturnToCell(Actor self)438 Activity ReturnToCell(Actor self); MoveIntoTarget(Actor self, Target target)439 Activity MoveIntoTarget(Actor self, Target target); VisualMove(Actor self, WPos fromPos, WPos toPos)440 Activity VisualMove(Actor self, WPos fromPos, WPos toPos); EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos)441 int EstimatedMoveDuration(Actor self, WPos fromPos, WPos toPos); NearestMoveableCell(CPos target)442 CPos NearestMoveableCell(CPos target); 443 MovementType CurrentMovementTypes { get; set; } CanEnterTargetNow(Actor self, Target target)444 bool CanEnterTargetNow(Actor self, Target target); 445 } 446 447 public interface IWrapMove 448 { WrapMove(Activity moveInner)449 Activity WrapMove(Activity moveInner); 450 } 451 452 public interface IAircraftCenterPositionOffset 453 { 454 WVec PositionOffset { get; } 455 } 456 457 public interface IOverrideAircraftLanding 458 { 459 HashSet<string> LandableTerrainTypes { get; } 460 } 461 462 public interface IRadarSignature 463 { PopulateRadarSignatureCells(Actor self, List<Pair<CPos, Color>> destinationBuffer)464 void PopulateRadarSignatureCells(Actor self, List<Pair<CPos, Color>> destinationBuffer); 465 } 466 RadarColorOverride(Actor self, Color color)467 public interface IRadarColorModifier { Color RadarColorOverride(Actor self, Color color); } 468 469 public interface IObjectivesPanel 470 { 471 string PanelName { get; } 472 int ExitDelay { get; } 473 } 474 475 [RequireExplicitImplementation] 476 public interface INotifyObjectivesUpdated 477 { OnObjectiveAdded(Player player, int objectiveID)478 void OnObjectiveAdded(Player player, int objectiveID); OnObjectiveCompleted(Player player, int objectiveID)479 void OnObjectiveCompleted(Player player, int objectiveID); OnObjectiveFailed(Player player, int objectiveID)480 void OnObjectiveFailed(Player player, int objectiveID); 481 } 482 483 [RequireExplicitImplementation] 484 public interface INotifyWinStateChanged 485 { OnPlayerWon(Player winner)486 void OnPlayerWon(Player winner); OnPlayerLost(Player loser)487 void OnPlayerLost(Player loser); 488 } 489 490 public interface INotifyCashTransfer 491 { OnAcceptingCash(Actor self, Actor donor)492 void OnAcceptingCash(Actor self, Actor donor); OnDeliveringCash(Actor self, Actor acceptor)493 void OnDeliveringCash(Actor self, Actor acceptor); 494 } 495 496 [RequireExplicitImplementation] 497 public interface ITargetableCells 498 { TargetableCells()499 Pair<CPos, SubCell>[] TargetableCells(); 500 } 501 502 [RequireExplicitImplementation] PreventShroudReset(Actor self)503 public interface IPreventsShroudReset { bool PreventShroudReset(Actor self); } 504 505 [RequireExplicitImplementation] BotEnabled(IBot bot)506 public interface IBotEnabled { void BotEnabled(IBot bot); } 507 508 [RequireExplicitImplementation] BotTick(IBot bot)509 public interface IBotTick { void BotTick(IBot bot); } 510 511 [RequireExplicitImplementation] RespondToAttack(IBot bot, Actor self, AttackInfo e)512 public interface IBotRespondToAttack { void RespondToAttack(IBot bot, Actor self, AttackInfo e); } 513 514 [RequireExplicitImplementation] 515 public interface IBotPositionsUpdated 516 { UpdatedBaseCenter(CPos newLocation)517 void UpdatedBaseCenter(CPos newLocation); UpdatedDefenseCenter(CPos newLocation)518 void UpdatedDefenseCenter(CPos newLocation); 519 } 520 521 [RequireExplicitImplementation] 522 public interface IBotNotifyIdleBaseUnits 523 { UpdatedIdleBaseUnits(List<Actor> idleUnits)524 void UpdatedIdleBaseUnits(List<Actor> idleUnits); 525 } 526 527 [RequireExplicitImplementation] 528 public interface IBotRequestUnitProduction 529 { RequestUnitProduction(IBot bot, string requestedActor)530 void RequestUnitProduction(IBot bot, string requestedActor); RequestedProductionCount(IBot bot, string requestedActor)531 int RequestedProductionCount(IBot bot, string requestedActor); 532 } 533 534 [RequireExplicitImplementation] 535 public interface IBotRequestPauseUnitProduction 536 { 537 bool PauseUnitProduction { get; } 538 } 539 540 [RequireExplicitImplementation] 541 public interface IEditorActorOptions : ITraitInfoInterface 542 { ActorOptions(ActorInfo ai, World world)543 IEnumerable<EditorActorOption> ActorOptions(ActorInfo ai, World world); 544 } 545 546 public abstract class EditorActorOption 547 { 548 public readonly string Name; 549 public readonly int DisplayOrder; 550 EditorActorOption(string name, int displayOrder)551 public EditorActorOption(string name, int displayOrder) 552 { 553 Name = name; 554 DisplayOrder = displayOrder; 555 } 556 } 557 558 public class EditorActorCheckbox : EditorActorOption 559 { 560 public readonly Func<EditorActorPreview, bool> GetValue; 561 public readonly Action<EditorActorPreview, bool> OnChange; 562 EditorActorCheckbox(string name, int displayOrder, Func<EditorActorPreview, bool> getValue, Action<EditorActorPreview, bool> onChange)563 public EditorActorCheckbox(string name, int displayOrder, 564 Func<EditorActorPreview, bool> getValue, 565 Action<EditorActorPreview, bool> onChange) 566 : base(name, displayOrder) 567 { 568 GetValue = getValue; 569 OnChange = onChange; 570 } 571 } 572 573 public class EditorActorSlider : EditorActorOption 574 { 575 public readonly float MinValue; 576 public readonly float MaxValue; 577 public readonly int Ticks; 578 public readonly Func<EditorActorPreview, float> GetValue; 579 public readonly Action<EditorActorPreview, float> OnChange; 580 EditorActorSlider(string name, int displayOrder, float minValue, float maxValue, int ticks, Func<EditorActorPreview, float> getValue, Action<EditorActorPreview, float> onChange)581 public EditorActorSlider(string name, int displayOrder, 582 float minValue, float maxValue, int ticks, 583 Func<EditorActorPreview, float> getValue, 584 Action<EditorActorPreview, float> onChange) 585 : base(name, displayOrder) 586 { 587 MinValue = minValue; 588 MaxValue = maxValue; 589 Ticks = ticks; 590 GetValue = getValue; 591 OnChange = onChange; 592 } 593 } 594 595 public class EditorActorDropdown : EditorActorOption 596 { 597 public readonly Dictionary<string, string> Labels; 598 public readonly Func<EditorActorPreview, string> GetValue; 599 public readonly Action<EditorActorPreview, string> OnChange; 600 EditorActorDropdown(string name, int displayOrder, Dictionary<string, string> labels, Func<EditorActorPreview, string> getValue, Action<EditorActorPreview, string> onChange)601 public EditorActorDropdown(string name, int displayOrder, 602 Dictionary<string, string> labels, 603 Func<EditorActorPreview, string> getValue, 604 Action<EditorActorPreview, string> onChange) 605 : base(name, displayOrder) 606 { 607 Labels = labels; 608 GetValue = getValue; 609 OnChange = onChange; 610 } 611 } 612 613 [RequireExplicitImplementation] 614 public interface IPreventMapSpawn 615 { PreventMapSpawn(World world, ActorReference actorReference)616 bool PreventMapSpawn(World world, ActorReference actorReference); 617 } 618 619 [Flags] 620 public enum MovementType 621 { 622 None = 0, 623 Horizontal = 1, 624 Vertical = 2, 625 Turn = 4 626 } 627 628 [RequireExplicitImplementation] 629 public interface INotifyMoving 630 { MovementTypeChanged(Actor self, MovementType type)631 void MovementTypeChanged(Actor self, MovementType type); 632 } 633 634 [RequireExplicitImplementation] 635 public interface INotifyTimeLimit 636 { NotifyTimerExpired(Actor self)637 void NotifyTimerExpired(Actor self); 638 } 639 } 640