Exemple #1
0
        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;
        }
Exemple #2
0
        public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
        {
            foreach (var paletteNode in actorNode.ChildrenMatching("PaletteFromCurrentTileset"))
            {
                var name   = "terrain";
                var shadow = new int[] { };

                var shadowNode = paletteNode.LastChildMatching("ShadowIndex");
                if (shadowNode != null)
                {
                    shadow = shadowNode.NodeValue <int[]>();
                }

                var nameNode = paletteNode.LastChildMatching("Name");
                if (nameNode != null)
                {
                    name = nameNode.Value.Value;
                }

                paletteTraits.Add(Tuple.Create(name, shadow));
            }

            actorNode.RemoveNodes("PaletteFromCurrentTileset");
            yield break;
        }
Exemple #3
0
        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;
        }
        public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
        {
            if (actorNode.RemoveNodes("WithPermanentInjury") > 0)
            {
                locations.Add("{0} ({1})".F(actorNode.Key, actorNode.Location.Filename));
            }

            yield break;
        }
Exemple #5
0
        public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
        {
            if (actorNode.RemoveNodes("LaysTerrain") > 0)
            {
                yield return("'LaysTerrain' was removed from {0} ({1}) without replacement.\n".F(actorNode.Key, actorNode.Location.Filename));
            }

            yield break;
        }
Exemple #6
0
        public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
        {
            if (actorNode.RemoveNodes("HarvesterResourceModifier") > 0 && !notified)
            {
                notified = true;
                yield return("The HarvesterResourceMultiplier trait is no longer supported and has been removed.");
            }

            actorNode.RenameChildrenMatching("RefineryResourceMultiplier", "ResourceValueMultiplier");
        }
Exemple #7
0
        public override IEnumerable <string> UpdateMapActorNode(ModData modData, MiniYamlNode actorNode)
        {
            if (actorNode.RemoveNodes("Plugs") > 0)
            {
                yield return("Initial plugs for actor {0} will need to be reconfigured using the map editor.".F(actorNode.Key));
            }

            if (actorNode.RemoveNodes("TurretFacings") > 0)
            {
                yield return("Initial turret facings for actor {0} will need to be reconfigured using the map editor.".F(actorNode.Key));
            }

            var bodyFacing = WAngle.Zero;

            foreach (var facing in actorNode.ChildrenMatching("Facing"))
            {
                bodyFacing = WAngle.FromFacing(facing.NodeValue <int>());
                facing.ReplaceValue(FieldSaver.FormatValue(bodyFacing));
            }

            var removeNodes = new List <MiniYamlNode>();

            foreach (var facing in actorNode.ChildrenMatching("TurretFacing"))
            {
                var turretFacing = WAngle.FromFacing(facing.NodeValue <int>()) - bodyFacing;
                if (turretFacing == WAngle.Zero)
                {
                    removeNodes.Add(facing);
                }
                else
                {
                    facing.ReplaceValue(FieldSaver.FormatValue(turretFacing));
                }
            }

            foreach (var node in removeNodes)
            {
                actorNode.Value.Nodes.Remove(node);
            }
        }
Exemple #8
0
        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");
            }
        }
Exemple #9
0
        public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
        {
            var addNodes = new List <MiniYamlNode>();

            foreach (var burns in actorNode.ChildrenMatching("Burns"))
            {
                var anim      = burns.LastChildMatching("Anim");
                var animValue = anim != null?anim.NodeValue <string>() : "1";

                var damage      = burns.LastChildMatching("Damage");
                var damageValue = damage != null?damage.NodeValue <int>() : 1;

                var interval      = burns.LastChildMatching("Interval");
                var intervalValue = interval != null?interval.NodeValue <int>() : 8;

                var overlay = new MiniYamlNode("WithIdleOverlay@Burns", "");
                overlay.AddNode("Image", FieldSaver.FormatValue("fire"));
                overlay.AddNode("Sequence", FieldSaver.FormatValue(animValue));
                overlay.AddNode("IsDecoration", FieldSaver.FormatValue(true));
                addNodes.Add(overlay);

                var changesHealth = new MiniYamlNode("ChangesHealth", "");
                changesHealth.AddNode("Step", FieldSaver.FormatValue(-damageValue));
                changesHealth.AddNode("StartIfBelow", FieldSaver.FormatValue(101));
                changesHealth.AddNode("Delay", FieldSaver.FormatValue(intervalValue));
                addNodes.Add(changesHealth);
            }

            actorNode.RemoveNodes("Burns");

            foreach (var addNode in addNodes)
            {
                actorNode.AddNode(addNode);
            }

            yield break;
        }
Exemple #10
0
        public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
        {
            foreach (var resourceNode in actorNode.ChildrenMatching("ResourceType"))
            {
                var typeNode = resourceNode.LastChildMatching("Type");
                if (typeNode != null)
                {
                    var resourceLayerNode = new MiniYamlNode(typeNode.Value.Value, "");
                    resourceLayer.Nodes.Add(resourceLayerNode);

                    var resourceRendererNode = new MiniYamlNode(typeNode.Value.Value, "");
                    resourceRenderer.Nodes.Add(resourceRendererNode);

                    var indexNode = resourceNode.LastChildMatching("ResourceType");
                    if (indexNode != null)
                    {
                        indexNode.RenameKey("ResourceIndex");
                        resourceLayerNode.AddNode(indexNode);
                    }

                    var terrainTypeNode = resourceNode.LastChildMatching("TerrainType");
                    if (terrainTypeNode != null)
                    {
                        resourceLayerNode.AddNode(terrainTypeNode);
                    }

                    var allowedTerrainNode = resourceNode.LastChildMatching("AllowedTerrainTypes");
                    if (allowedTerrainNode != null)
                    {
                        resourceLayerNode.AddNode(allowedTerrainNode);
                    }

                    var maxDensityNode = resourceNode.LastChildMatching("MaxDensity");
                    if (maxDensityNode != null)
                    {
                        resourceLayerNode.AddNode(maxDensityNode);
                    }

                    var valueNode = resourceNode.LastChildMatching("ValuePerUnit");
                    if (valueNode != null)
                    {
                        values.Nodes.Add(new MiniYamlNode(typeNode.Value.Value, valueNode.Value.Value));
                    }

                    var imageNode = resourceNode.LastChildMatching("Image");
                    if (imageNode != null)
                    {
                        resourceRendererNode.AddNode(imageNode);
                    }

                    var sequencesNode = resourceNode.LastChildMatching("Sequences");
                    if (sequencesNode != null)
                    {
                        resourceRendererNode.AddNode(sequencesNode);
                    }

                    var paletteNode = resourceNode.LastChildMatching("Palette");
                    if (paletteNode != null)
                    {
                        resourceRendererNode.AddNode(paletteNode);
                    }

                    var nameNode = resourceNode.LastChildMatching("Name");
                    if (nameNode != null)
                    {
                        resourceRendererNode.AddNode(nameNode);
                    }
                }
                else
                {
                    yield return("Unable to process definition:\n" +
                                 resourceNode.Value.ToLines(resourceNode.Key).JoinWith("\n") + "\n\n" +
                                 "This override has been removed and must be manually reimplemented if still needed.");
                }
            }

            actorNode.RemoveNodes("ResourceType");

            foreach (var resourceRendererNode in actorNode.ChildrenMatching("ResourceRenderer"))
            {
                resourceRendererNode.RemoveNodes("RenderTypes");
            }

            foreach (var resourceRendererNode in actorNode.ChildrenMatching("D2kResourceRenderer"))
            {
                resourceRendererNode.RemoveNodes("RenderTypes");
            }
        }
 public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
 {
     actorNode.RemoveNodes("ConditionManager");
     yield break;
 }
Exemple #12
0
 public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
 {
     actorNode.RemoveNodes("PlayerHighlightPalette");
     yield break;
 }
Exemple #13
0
 public override IEnumerable <string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
 {
     actorNode.RemoveNodes("BuildingInfluence");
     yield break;
 }