public CommandParser(SafeLightningMod mod) { this.monitor = mod.Monitor; //Get available commands this.commands = new List <ICommand> { new PrintLocationCommand(), new SetLightningCommand(), new GrowTreesCommand(), new RemoveFeaturesCommand() }; //Register both a long and short command, hiding dangerous commands foreach (string s in new List <string> { "safe_lightning", "sl" }) { string helpString = "Safe lightning related debug commands.\n\nUsage:\n"; foreach (ICommand command in this.commands) { if (command.Dangerous) { continue; } helpString += $" {s} {command.Description} \n"; } this.descriptions.Add(s, helpString); mod.Helper.ConsoleCommands.Add(s, helpString, this.ParseCommand); } }
/// <summary> /// Gets the current lightning RNG conditions, but in the next 10 minutes. /// </summary> /// <param name="next">Increment the current time by 10 minutes</param> public LightningStrikeRNGInfo(bool next) : this() { if (next) { this.time = SafeLightningMod.GetNextTime(this.time); } }
public override string Parse(string[] args) { string result = "Okay, lightning strikes today will be at:"; for (int i = 600; i < 2400; i = SafeLightningMod.GetNextTime(i)) { if (SDVLightningMimic.GetSDVLightningStrikePositionAt(new LightningStrikeRNGInfo(i), out KeyValuePair <Vector2, TerrainFeature>?feature)) { result += $"\nLightning strike: {i} at {feature.Value.Key} on {feature.Value.Value.GetType().Name}."; } } return(result); }