public static void delayedupdate() { int delaydelta = delay2++ % 100; if (delaydelta == 1) { ScriptingCore.OnEvent("update"); } if (delaydelta == 10) { onchange(); } if (delaydelta == 20) { newday(); } if (delaydelta == 30) { noon(); } }
public static bool SetResearchCost(string research, string costtype, float costamount) { if (Db.Get().Techs.resources == null) { return(false); } foreach (Tech techtoadd in Db.Get().Techs.resources) { if (techtoadd.Id == research) { var res = Research.Instance.Get(techtoadd); if (res.tech.costsByResearchTypeID.ContainsKey(costtype)) { res.tech.costsByResearchTypeID[costtype] = costamount; } return(true); } } ScriptingCore.DebugLogError("SetResearchCost did not find: " + research); return(false); }
public static bool AddResearch(string research) { foreach (Tech techtoadd in Db.Get().Techs.resources) { if (techtoadd.Id == research) { var res = Research.Instance.Get(techtoadd); var req = Research.Instance.Get(techtoadd).tech.requiredTech; foreach (var i in req) { AddResearch(i.Id); } if (res == null) { ScriptingCore.DebugLogError("AddResearch did not find: " + research); return(false); } res.Purchased(); return(true); } } ScriptingCore.DebugLogError("AddResearch did not find: " + research); return(false); }
public static bool AddHelpInfo <T>(string Functionnameinlua, string Helptext = "", bool log = true) { if (log) { ScriptingCore.LuaDebugLog("AddHelpInfo: " + Functionnameinlua); } if (ScriptingCore.helpdict.ContainsKey(Functionnameinlua)) { ScriptingCore.InfoLog("The info " + Functionnameinlua + " is already registered skipping it! "); } else { ScriptingCore.helpdict.Add(Functionnameinlua, Helptext); } if (ScriptingCore.classhelpdict.ContainsKey(Functionnameinlua)) { ScriptingCore.InfoLog("The classhelpdict " + Functionnameinlua + " is already registered skipping it! "); } else { ScriptingCore.classhelpdict.Add(Functionnameinlua, typeof(T).AssemblyQualifiedName); } return(true); }
public static void Prefix() { ScriptingCore.OnEvent("directupdate"); delayedupdate(); }
public static void Prefix() { ScriptingCore.OnEvent("maploaded"); }
public static void Postfix() { ScriptingCore.LuaDebugLog("loadbuildings"); ScriptingCore.OnEvent("loadbuildings"); }
public static void Prefix() { ScriptingCore.OnEvent("DbInitialize"); }
public static void onchange() { ScriptingCore.OnEvent("onchange"); }