Skip to content

Instantly share code, notes, and snippets.

@MustaphaTR
Last active June 27, 2018 21:03
Show Gist options
  • Select an option

  • Save MustaphaTR/f307532d07d3b32be94b130a2a2252c9 to your computer and use it in GitHub Desktop.

Select an option

Save MustaphaTR/f307532d07d3b32be94b130a2a2252c9 to your computer and use it in GitHub Desktop.
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
var queues = new List<MiniYamlNode>();
foreach (var q in actorNode.ChildrenMatching("ProductionQueue"))
queues.Add(q);
foreach (var q in actorNode.ChildrenMatching("ClassicProductionQueue"))
queues.Add(q);
foreach (var queue in queues)
{
var lowPower = queue.LastChildMatching("LowPowerSlowdown");
if (lowPower != null)
{
if (lowPower.NodeValue<int>() == 1)
queue.RemoveNodes("LowPowerSlowdown");
else
{
lowPower.RenameKey("LowPowerModifier");
lowPower.ReplaceValue((lowPower.NodeValue<int>() * 100).ToString());
}
}
else
queue.AddNode("LowPowerModifier", "300");
}
yield break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment