public static void LoadMetadata(Level lvl) { lvl.Config.JailX = (ushort)(lvl.spawnx * 32); lvl.Config.JailY = (ushort)(lvl.spawny * 32); lvl.Config.JailZ = (ushort)(lvl.spawnz * 32); lvl.Config.jailrotx = lvl.rotx; lvl.Config.jailroty = lvl.roty; try { string propsPath = LevelInfo.PropsPath(lvl.MapName); bool propsExisted = lvl.Config.Load(propsPath); if (propsExisted) { lvl.SetPhysics(lvl.Config.Physics); } else { Logger.Log(LogType.ConsoleMessage, ".properties file for level {0} was not found.", lvl.MapName); } // Backwards compatibility for older levels which had .env files. string envPath = "levels/level properties/" + lvl.MapName + ".env"; lvl.Config.Load(envPath); } catch (Exception e) { Logger.LogError(e); } lvl.BlockDB.Cache.Enabled = lvl.Config.UseBlockDB; BlockDefinition[] defs = BlockDefinition.Load(false, lvl.MapName); for (int b = 0; b < defs.Length; b++) { if (defs[b] == null) { continue; } lvl.UpdateCustomBlock((BlockID)b, defs[b]); } lvl.UpdateBlockProps(); lvl.UpdateBlockHandlers(); }
public static void LoadMetadata(Level lvl) { lvl.Config.JailX = (ushort)(lvl.spawnx * 32); lvl.Config.JailY = (ushort)(lvl.spawny * 32); lvl.Config.JailZ = (ushort)(lvl.spawnz * 32); lvl.Config.jailrotx = lvl.rotx; lvl.Config.jailroty = lvl.roty; try { string propsPath = LevelInfo.PropsPath(lvl.MapName); if (lvl.Config.Load(propsPath)) { lvl.SetPhysics(lvl.Config.Physics); } else { Logger.Log(LogType.ConsoleMessage, ".properties file for level {0} was not found.", lvl.MapName); } } catch (Exception e) { Logger.LogError(e); } lvl.BlockDB.Cache.Enabled = lvl.Config.UseBlockDB; string blockDefsPath = Paths.MapBlockDefs(lvl.MapName); BlockDefinition[] defs = BlockDefinition.Load(blockDefsPath); for (int b = 0; b < defs.Length; b++) { if (defs[b] == null) { continue; } lvl.UpdateCustomBlock((BlockID)b, defs[b]); } lvl.UpdateBlockProps(); lvl.UpdateBlockHandlers(); }
public static void LoadMetadata(Level lvl) { try { string propsPath = LevelInfo.PropertiesPath(lvl.MapName); bool propsExisted = LevelConfig.Load(propsPath, lvl.Config); if (propsExisted) { lvl.setPhysics(lvl.Config.Physics); } else { Logger.Log(LogType.ConsoleMessage, ".properties file for level {0} was not found.", lvl.MapName); } // Backwards compatibility for older levels which had .env files. string envPath = "levels/level properties/" + lvl.MapName + ".env"; LevelConfig.Load(envPath, lvl.Config); } catch (Exception e) { Logger.LogError(e); } lvl.BlockDB.Cache.Enabled = lvl.Config.UseBlockDB; BlockDefinition[] defs = BlockDefinition.Load(false, lvl); for (int i = 0; i < defs.Length; i++) { if (defs[i] == null) { continue; } lvl.UpdateCustomBlock((byte)i, defs[i]); } lvl.UpdateBlockProps(); lvl.UpdateBlockHandlers(); }