static NOGMapConfig RetrieveConfig(Player p) { NOGMapConfig cfg = new NOGMapConfig(); cfg.SetDefaults(p.level); cfg.Load(p.level.name); return(cfg); }
static void UpdateConfig(Player p, NOGMapConfig cfg) { if (!Directory.Exists("NameOfGamemode")) { Directory.CreateDirectory("NameOfGamemode"); } cfg.Save(p.level.name); if (p.level == NOGGame.Instance.Map) { NOGGame.Instance.UpdateMapConfig(); } }
protected override void HandleSet(Player p, RoundsGame game, string[] args) { if (args.Length < 2) { Help(p, "set"); return; } string prop = args[1]; if (prop.CaselessEq("spawn")) { NOGMapConfig cfg = RetrieveConfig(p); cfg.Spawn = (Vec3U16)p.Pos.FeetBlockCoords; p.Message("Set spawn pos to: &b{0}", cfg.Spawn); UpdateConfig(p, cfg); return; } if (args.Length < 3) { Help(p, "set"); } }
// ============================================ GAME ======================================= public override void UpdateMapConfig() { cfg = new NOGMapConfig(); cfg.SetDefaults(Map); cfg.Load(Map.name); }