public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var givesBuildableArea = actorNode.LastChildMatching("GivesBuildableArea"); if (givesBuildableArea != null) { givesBuildableArea.AddNode("AreaTypes", "building"); } var building = actorNode.LastChildMatching("Building"); if (building != null) { var requiresBuildableArea = new MiniYamlNode("RequiresBuildableArea", ""); requiresBuildableArea.AddNode("AreaTypes", "building"); var adjacent = building.LastChildMatching("Adjacent"); if (adjacent != null) { requiresBuildableArea.AddNode(adjacent); } actorNode.AddNode(requiresBuildableArea); building.RemoveNodes("Adjacent"); } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var aircraft = actorNode.LastChildMatching("Aircraft"); if (aircraft != null) { var initialFacing = aircraft.LastChildMatching("InitialFacing"); var isVTOL = false; var vtolNode = aircraft.LastChildMatching("VTOL"); if (vtolNode != null) { isVTOL = vtolNode.NodeValue <bool>(); } // If InitialFacing is defined or it's a VTOL, no changes are needed. if (initialFacing != null || isVTOL) { yield break; } nonVTOLs.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename)); } yield break; }
public override IEnumerable <string> UpdateWeaponNode(ModData modData, MiniYamlNode weaponNode) { foreach (var node in weaponNode.ChildrenMatching("Warhead")) { if (node.Value.Value == "CreateEffect") { var victimScanRadius = node.LastChildMatching("VictimScanRadius"); if (victimScanRadius != null && victimScanRadius.NodeValue <int>() == 0) { node.AddNode("ImpactActors", "false"); } node.RemoveNodes("VictimScanRadius"); } } var projectile = weaponNode.LastChildMatching("Projectile"); if (projectile != null) { projectile.RemoveNodes("BounceBlockerScanRadius"); projectile.RemoveNodes("BlockerScanRadius"); projectile.RemoveNodes("AreaVictimScanRadius"); } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { if (complete || actorNode.LastChildMatching("IsometricSelectable") != null) { yield break; } var height = 0; if (!selectionHeight.TryGetValue(actorNode.Key.ToLowerInvariant(), out height)) { yield break; } // Don't redefine the default value if (height == 24) { yield break; } var selection = new MiniYamlNode("IsometricSelectable", ""); selection.AddNode("Height", FieldSaver.FormatValue(height)); actorNode.AddNode(selection); }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { // Aircraft isn't conditional or otherwise supports multiple traits, so LastChildMatching is fine. var aircraftNode = actorNode.LastChildMatching("Aircraft"); if (aircraftNode != null) { var repairBuildings = aircraftNode.LastChildMatching("RepairBuildings"); if (repairBuildings != null) { var repariableNode = new MiniYamlNode("Repairable", ""); repairBuildings.MoveAndRenameNode(aircraftNode, repariableNode, "RepairBuildings"); var voice = aircraftNode.LastChildMatching("Voice"); if (voice != null) { repariableNode.AddNode(voice); } actorNode.AddNode(repariableNode); } } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { foreach (var announce in actorNode.ChildrenMatching("AnnounceOnBuild")) { announce.RenameKey("VoiceAnnouncement"); if (announce.LastChildMatching("Voice") == null) { announce.AddNode("Voice", "Build"); } } var used = new List <string>(); foreach (var t in Traits) { if (actorNode.LastChildMatching(t) != null) { used.Add(t); } } if (used.Any()) { var location = "{0} ({1})".F(actorNode.Key, actorNode.Location.Filename); locations[location] = used; } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var psb = actorNode.LastChildMatching("PlaceSimpleBeacon"); if (psb == null) { yield break; } psb.RenameKey("PlaceBeacon"); var palette = psb.LastChildMatching("Palette"); var isPlayer = psb.LastChildMatching("IsPlayerPalette"); var sequence = psb.LastChildMatching("BeaconSequence"); if (palette == null) { psb.AddNode("Palette", "effect"); } if (isPlayer == null) { psb.AddNode("IsPlayerPalette", "false"); } if (sequence == null) { psb.AddNode("BeaconSequence", "idle"); } psb.AddNode("ArrowSequence", ""); psb.AddNode("CircleSequence", ""); yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var doc = actorNode.LastChildMatching("DisableOnCondition"); var grant = actorNode.LastChildMatching("GrantConditionOnDisabled"); if (!displayed && (doc != null || grant != null)) { displayed = true; yield return("Actor.IsDisabled has been removed in favor of pausing/disabling traits via conditions.\n" + "DisableOnCondition and GrantConditionOnDisabled were stop-gap solutions that have been removed along with it.\n" + "You'll have to use RequiresCondition or PauseOnCondition on individual traits to 'disable' actors."); } actorNode.RemoveNodes("DisableOnCondition"); actorNode.RemoveNodes("GrantConditionOnDisabled"); yield break; }
void UpdatePower(MiniYamlNode power) { var range = 1; var rangeNode = power.LastChildMatching("Range"); if (rangeNode != null) { range = rangeNode.NodeValue <int>(); if (range > 3) { locations.Add("{0} ({1})".F(rangeNode.Key, rangeNode.Location.Filename)); } power.RemoveNode(rangeNode); } var size = 2 * range + 1; power.AddNode(new MiniYamlNode("Dimensions", size.ToString() + ", " + size.ToString())); var footprint = string.Empty; var emptycell = range; var affectedcell = 1; for (var i = 0; i < size; i++) { for (var e = 0; e < emptycell; e++) { footprint += '_'; } for (var a = 0; a < affectedcell; a++) { footprint += 'x'; } for (var e = 0; e < emptycell; e++) { footprint += '_'; } if (i < range) { emptycell--; affectedcell += 2; } else { emptycell++; affectedcell -= 2; } footprint += ' '; } power.AddNode(new MiniYamlNode("Footprint", footprint)); }
void ApplyChanges(MiniYamlNode actorNode, MiniYamlNode node) { // Type renamed to Types var type = node.LastChildMatching("Type"); if (type != null) type.RenameKey("Types"); // Allow(Allies|Neutral|Enemies) replaced with a ValidStances enum var stance = Stance.Neutral | Stance.Enemy; var allowAllies = node.LastChildMatching("AllowAllies"); if (allowAllies != null) { if (allowAllies.NodeValue<bool>()) stance |= Stance.Ally; else stance &= ~Stance.Ally; node.RemoveNode(allowAllies); } var allowNeutral = node.LastChildMatching("AllowNeutral"); if (allowNeutral != null) { if (allowNeutral.NodeValue<bool>()) stance |= Stance.Neutral; else stance &= ~Stance.Neutral; node.RemoveNode(allowNeutral); } var allowEnemies = node.LastChildMatching("AllowEnemies"); if (allowEnemies != null) { if (allowEnemies.NodeValue<bool>()) stance |= Stance.Enemy; else stance &= ~Stance.Enemy; node.RemoveNode(allowEnemies); } if (stance != (Stance.Neutral | Stance.Enemy)) node.AddNode("ValidStances", stance); }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { if (actorNode.LastChildMatching("Explodes") != null) { locations.Add("{0} ({1})".F(actorNode.Key, actorNode.Location.Filename)); } yield break; }
public override IEnumerable <string> UpdateTilesetNode(ModData modData, MiniYamlNode tilesetNode) { if (tilesetNode.Key == "General") { var idNode = tilesetNode.LastChildMatching("Id"); if (idNode == null) { yield break; } var paletteNode = tilesetNode.LastChildMatching("Palette"); if (paletteNode != null) { tilesetPalettes[idNode.Value.Value] = paletteNode.Value.Value; } tilesetNode.RemoveNodes("Palette"); } }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var aircraft = actorNode.LastChildMatching("Aircraft"); var returnOnIdle = actorNode.LastChildMatching("ReturnOnIdle"); var flyAwayOnIdle = actorNode.LastChildMatching("FlyAwayOnIdle"); if (aircraft != null) { var landWhenIdle = false; var landWhenIdleNode = aircraft.LastChildMatching("LandWhenIdle"); if (landWhenIdleNode != null) { landWhenIdle = landWhenIdleNode.NodeValue <bool>(); aircraft.RemoveNode(landWhenIdleNode); } // FlyAwayOnIdle should have had higher priority than LandWhenIdle even if both were 'true'. // ReturnOnIdle has been broken for so long that it's safer to ignore it here and only inform // the modder of the places it's been removed from, so they can change the IdleBehavior manually if desired. if (flyAwayOnIdle != null && !flyAwayOnIdle.IsRemoval()) { aircraft.AddNode(new MiniYamlNode("IdleBehavior", "LeaveMap")); } else if (landWhenIdle) { aircraft.AddNode(new MiniYamlNode("IdleBehavior", "Land")); } } if (flyAwayOnIdle != null) { actorNode.RemoveNode(flyAwayOnIdle); } if (returnOnIdle != null) { returnOnIdles.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename)); actorNode.RemoveNode(returnOnIdle); } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { // RepairableBuilding is hardcoded to only support one instance per actor var rb = actorNode.LastChildMatching("RepairableBuilding"); if (rb != null) { var imageNode = rb.LastChildMatching("IndicatorImage"); var sequenceNode = rb.LastChildMatching("IndicatorSequence"); var paletteNode = rb.LastChildMatching("IndicatorPalette"); var palettePrefixNode = rb.LastChildMatching("IndicatorPalettePrefix"); var decoration = new MiniYamlNode("WithBuildingRepairDecoration", ""); decoration.AddNode("Image", imageNode != null ? imageNode.Value.Value : "allyrepair"); decoration.AddNode("Sequence", sequenceNode != null ? sequenceNode.Value.Value : "repair"); decoration.AddNode("ReferencePoint", "Center"); if (paletteNode != null) { decoration.AddNode("Palette", paletteNode.Value.Value); } else { decoration.AddNode("Palette", palettePrefixNode != null ? palettePrefixNode.Value.Value : "player"); decoration.AddNode("IsPlayerPalette", true); } actorNode.AddNode(decoration); rb.RemoveNode(imageNode); rb.RemoveNode(sequenceNode); rb.RemoveNode(paletteNode); rb.RemoveNode(palettePrefixNode); } if (actorNode.LastChildMatching("-RepairableBuilding") != null) { actorNode.AddNode("-WithBuildingRepairDecoration", ""); } yield break; }
public override IEnumerable <string> UpdateWeaponNode(ModData modData, MiniYamlNode weaponNode) { var bd = weaponNode.LastChildMatching("BurstDelay"); if (bd != null) { bd.RenameKey("BurstDelays"); } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var aircraft = actorNode.LastChildMatching("Aircraft"); if (aircraft != null) { var attackAircraft = actorNode.LastChildMatching("AttackAircraft"); if (attackAircraft == null) { yield break; } var attackType = attackAircraft.LastChildMatching("AttackType"); if (attackType.NodeValue <AirAttackType>() == AirAttackType.Strafe) { attackAircraft.RemoveNode(attackType); } attackAircraft.RemoveNodes("AttackTurnDelay"); } }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var gate = actorNode.LastChildMatching("Gate"); if (gate == null) { yield break; } var openSound = gate.LastChildMatching("OpeningSound"); var closeSound = gate.LastChildMatching("ClosingSound"); var closeDelay = gate.LastChildMatching("CloseDelay"); var transitDelay = gate.LastChildMatching("TransitionDelay"); var blockHeight = gate.LastChildMatching("BlocksProjectilesHeight"); var newGate = new MiniYamlNode("Gate", ""); gate.RenameKey("Building"); if (openSound != null) { newGate.AddNode(openSound); gate.RemoveNode(openSound); } if (closeSound != null) { newGate.AddNode(closeSound); gate.RemoveNode(closeSound); } if (closeDelay != null) { newGate.AddNode(closeDelay); gate.RemoveNode(closeDelay); } if (transitDelay != null) { newGate.AddNode(transitDelay); gate.RemoveNode(transitDelay); } if (blockHeight != null) { newGate.AddNode(blockHeight); gate.RemoveNode(blockHeight); } actorNode.AddNode(newGate); yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { foreach (var t in infiltrateForTraits) { if (actorNode.LastChildMatching(t) != null) { infiltrateForLocations.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename)); yield break; } } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var autoCarryall = actorNode.LastChildMatching("AutoCarryall"); if (autoCarryall == null) { yield break; } showMessage = true; yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var pauseAnimation = actorNode.LastChildMatching("PauseAnimationWhenDisabled"); if (pauseAnimation == null) { yield break; } pauseAnimation.RenameKey("PauseCondition"); pauseAnimation.ReplaceValue("disabled"); yield return("'PauseAnimationWhenDisabled' was removed from 'WithSpriteBody' and replaced by conditions.\n" + "You might need to review your condition setup."); }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var airProd = actorNode.LastChildMatching("ProductionAirdrop"); if (airProd != null) { var actorTypeNode = airProd.LastChildMatching("ActorType"); if (actorTypeNode == null) { missingActorTypes.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename)); } } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { // Repairable isn't conditional or otherwise supports multiple traits, so LastChildMatching should be fine. var repairableNode = actorNode.LastChildMatching("Repairable"); if (repairableNode != null) { var repairBuildings = repairableNode.LastChildMatching("RepairBuildings"); if (repairBuildings != null) { repairBuildings.RenameKey("RepairActors"); } else { repairableNode.AddNode(new MiniYamlNode("RepairActors", "fix")); } } // RepairableNear isn't conditional or otherwise supports multiple traits, so LastChildMatching should be fine. var repairableNearNode = actorNode.LastChildMatching("RepairableNear"); if (repairableNearNode != null) { var repairBuildings = repairableNearNode.LastChildMatching("Buildings"); if (repairBuildings != null) { repairBuildings.RenameKey("RepairActors"); } else { repairableNearNode.AddNode(new MiniYamlNode("RepairActors", "spen, syrd")); } } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var canPowerDown = actorNode.LastChildMatching("CanPowerDown"); if (canPowerDown == null) { yield break; } canPowerDown.AddNode("PowerdownCondition", "powerdown"); var image = canPowerDown.LastChildMatching("IndicatorImage"); var seq = canPowerDown.LastChildMatching("IndicatorSequence"); var pal = canPowerDown.LastChildMatching("IndicatorPalette"); var imageValue = image != null?image.NodeValue <string>() : "poweroff"; var seqValue = seq != null?seq.NodeValue <string>() : "offline"; var palValue = pal != null?pal.NodeValue <string>() : "chrome"; var indicator = new MiniYamlNode("WithDecoration@POWERDOWN", ""); indicator.AddNode("Image", imageValue); indicator.AddNode("Sequence", seqValue); indicator.AddNode("Palette", palValue); indicator.AddNode("RequiresCondition", "powerdown"); indicator.AddNode("ReferencePoint", "Center"); actorNode.AddNode(indicator); if (image != null) { canPowerDown.RemoveNodes("IndicatorImage"); } if (seq != null) { canPowerDown.RemoveNodes("IndicatorSequence"); } if (pal != null) { canPowerDown.RemoveNodes("IndicatorPalette"); } if (!displayed) { displayed = true; yield return("'CanPowerDown' now provides a condition. You might need to review your condition setup."); } }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { if (!hasAutoCarryable) { hasAutoCarryable = actorNode.ChildrenMatching("AutoCarryable").Any(); } var harvester = actorNode.LastChildMatching("Harvester"); if (harvester != null) { harvesters.Add("{0} ({1})".F(actorNode.Key, harvester.Location.Filename)); } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var reloadAmmoPool = actorNode.LastChildMatching("ReloadAmmoPool"); var armaments = actorNode.ChildrenMatching("Armament"); var ammoPools = actorNode.ChildrenMatching("AmmoPool"); if (reloadAmmoPool != null || !armaments.Any() || !ammoPools.Any()) { yield break; } foreach (var pool in ammoPools) { var nameNode = pool.LastChildMatching("Armaments"); var name = nameNode != null?nameNode.NodeValue <string>() : "primary, secondary"; var anyMatchingArmament = false; var ammoNoAmmo = new MiniYamlNode("AmmoCondition", "ammo"); var armNoAmmo = new MiniYamlNode("PauseOnCondition", "!ammo"); foreach (var arma in armaments) { var armaNameNode = arma.LastChildMatching("Name"); var armaName = armaNameNode != null?armaNameNode.NodeValue <string>() : "primary"; if (name.Contains(armaName)) { anyMatchingArmament = true; arma.AddNode(armNoAmmo); } } if (anyMatchingArmament) { pool.AddNode(ammoNoAmmo); if (!messageDisplayed) { yield return("Aircraft returning to base is now triggered when all armaments are paused via condition.\n" + "Check if any of your actors with AmmoPools may need further changes."); messageDisplayed = true; } } } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var aircraft = actorNode.LastChildMatching("Aircraft"); if (aircraft != null) { var turnToDock = aircraft.LastChildMatching("TurnToDock"); if (turnToDock != null || turnToDock.NodeValue <bool>()) { yield break; } turningAircraft.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename)); } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var mobileNode = actorNode.ChildrenMatching("Mobile").FirstOrDefault(m => !m.IsRemoval()); if (mobileNode != null) { var considerTurnAsMoveNode = mobileNode.LastChildMatching("AlwaysConsiderTurnAsMove"); if (considerTurnAsMoveNode != null) { mobileNode.RemoveNode(considerTurnAsMoveNode); } } var used = new List <string>(); var grantMoveConditions = actorNode.ChildrenMatching("GrantConditionOnMovement"); foreach (var g in grantMoveConditions) { var considerVerticalNode = g.LastChildMatching("ConsiderVerticalMovement"); if (considerVerticalNode != null) { g.RemoveNode(considerVerticalNode); } } if (grantMoveConditions.Any()) { used.Add("GrantConditionOnMovement"); } var moveAnim = actorNode.LastChildMatching("WithMoveAnimation"); if (moveAnim != null) { used.Add("WithMoveAnimation"); } if (used.Any()) { var location = "{0} ({1})".F(actorNode.Key, actorNode.Location.Filename); locations[location] = used; } yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var autoSelectionSize = actorNode.LastChildMatching("AutoSelectionSize"); if (autoSelectionSize != null) { actorNode.AddNode("Interactable", ""); } var customSelectionSize = actorNode.LastChildMatching("CustomSelectionSize"); if (customSelectionSize != null) { var bounds = customSelectionSize.LastChildMatching("CustomBounds"); var customRenderSize = new MiniYamlNode("Interactable", ""); if (bounds != null) { customRenderSize.AddNode("Bounds", bounds.NodeValue <int[]>()); } actorNode.AddNode(customRenderSize); } var sd = actorNode.LastChildMatching("SelectionDecorations"); if (sd != null) { var boundsNode = sd.LastChildMatching("VisualBounds"); if (boundsNode != null) { boundsNode.RenameKey("DecorationBounds"); sd.RemoveNode(boundsNode); var selectable = actorNode.LastChildMatching("Selectable"); if (selectable == null) { selectable = new MiniYamlNode("Selectable", new MiniYaml("")); actorNode.AddNode(selectable); } selectable.AddNode(boundsNode); } } if (actorNode.LastChildMatching("-Selectable") != null && actorNode.LastChildMatching("Interactable") == null) { actorNode.AddNode("Interactable", ""); } actorNode.RemoveNodes("CustomSelectionSize"); actorNode.RemoveNodes("AutoSelectionSize"); yield break; }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var requiresPower = actorNode.LastChildMatching("RequiresPower"); if (requiresPower == null) { yield break; } requiresPower.RenameKey("GrantConditionOnPowerState@LOWPOWER", false); requiresPower.AddNode("Condition", "lowpower"); requiresPower.AddNode("ValidPowerStates", "Low, Critical"); if (!displayed) { displayed = true; yield return("'RequiresPower' was renamed to 'GrantConditionOnPowerState'.\n" + "You might need to review your condition setup."); } }
public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode) { var used = new List <string>(); foreach (var t in Traits) { if (actorNode.LastChildMatching(t, includeRemovals: false) != null) { used.Add(t); } } if (used.Any()) { var location = "{0} ({1})".F(actorNode.Key, actorNode.Location.Filename); locations[location] = used; } yield break; }