public void AfterSelectedWorld() { StringBuilder sb = new StringBuilder(); APILogger.LogToFile("-------------------Texture Mapping Loaded----------------------"); var i = 0; foreach (var item in LoadedAssembalies) { if (Activator.CreateInstance(item) is ICSTextureMapping texture && !string.IsNullOrEmpty(texture.name)) { ItemTypesServer.SetTextureMapping(texture.name, new ItemTypesServer.TextureMapping(texture.JsonSerialize())); sb.Append($"{texture.name}, "); i++; if (i > 5) { i = 0; sb.AppendLine(); } } } APILogger.LogToFile(sb.ToString()); APILogger.LogToFile("---------------------------------------------------------"); }
public static void AfterSelectedWorld() { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = MultiPath.Combine(ConstructionModEntries.AssetsDirectory, "textures", "albedo", "capsulesTop.png"); ItemTypesServer.SetTextureMapping(ConstructionModEntries.MOD_PREFIX + "capsuletop", textureMapping); }
public static void AddTextures() { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "StoneTurret.png"; textureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; textureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(STONE_NAMESPACE + "sides", textureMapping); var bronzetextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); bronzetextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "ArrowTurret.png"; bronzetextureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; bronzetextureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(BRONZEARROW_NAMESPACE + "sides", bronzetextureMapping); var crossbowtextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); crossbowtextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "CrossbowTurret.png"; crossbowtextureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; crossbowtextureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(CROSSBOW_NAMESPACE + "sides", crossbowtextureMapping); var matchlocktextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); matchlocktextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "MatchlockTurret.png"; matchlocktextureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; matchlocktextureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(MATCHLOCK_NAMESPACE + "sides", matchlocktextureMapping); }
public static void AddTextures() { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/StoneTurret.png"; textureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/Turret.png"; textureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/Turret.png"; ItemTypesServer.SetTextureMapping(STONE_NAMESPACE + "sides", textureMapping); var bronzetextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); bronzetextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/ArrowTurret.png"; bronzetextureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/Turret.png"; bronzetextureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/Turret.png"; ItemTypesServer.SetTextureMapping(BRONZEARROW_NAMESPACE + "sides", bronzetextureMapping); var crossbowtextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); crossbowtextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/CrossbowTurret.png"; crossbowtextureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/Turret.png"; crossbowtextureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/Turret.png"; ItemTypesServer.SetTextureMapping(CROSSBOW_NAMESPACE + "sides", crossbowtextureMapping); var matchlocktextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); matchlocktextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/MatchlockTurret.png"; matchlocktextureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/Turret.png"; matchlocktextureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/Turret.png"; ItemTypesServer.SetTextureMapping(MATCHLOCK_NAMESPACE + "sides", matchlocktextureMapping); }
public static void AddTextures() { var flagTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); flagTextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/PatrolFlag.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".PatrolFlag", flagTextureMapping); }
public static void AddTextures() { var flagTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); flagTextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "PatrolFlag.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".PatrolFlag", flagTextureMapping); }
public static void AddTextures() { var minerTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); minerTextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/MiningMachine.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".Miner", minerTextureMapping); }
public static void AddTextures() { var minerTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); minerTextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "MiningMachine.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".Miner", minerTextureMapping); }
public static void AddTextures() { var TeleportPadTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); TeleportPadTextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "TeleportPad.png"; TeleportPadTextureMapping.EmissivePath = GameLoader.BLOCKS_EMISSIVE_PATH + "TeleportPad.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".TeleportPad", TeleportPadTextureMapping); }
public static void AddTextures() { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/AdvancedCraftingTableTop.png"; textureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/AdvancedCraftingTableTop.png"; textureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/AdvancedCraftingTableTop.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + "AdvancedCraftingTableTop", textureMapping); }
public static void AddTextures() { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "AdvancedCraftingTableTop.png"; textureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "AdvancedCraftingTableTop.png"; textureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "AdvancedCraftingTableTop.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + "AdvancedCraftingTableTop", textureMapping); }
public static void AddCarpetTextures(string key) { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + key + ".png"; textureMapping.NormalPath = "gamedata/textures/materials/blocks/normal/carpet.png"; textureMapping.EmissivePath = "gamedata/textures/materials/blocks/emissiveMaskAlpha/neutral.png"; textureMapping.HeightPath = "gamedata/textures/materials/blocks/heightSmoothnessSpecularity/carpet.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + "." + key, textureMapping); }
public static void AddTextures() { var GateLeverTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); GateLeverTextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/Lever.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".GateLever", GateLeverTextureMapping); var GateTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); GateTextureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/gate.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".Gate", GateTextureMapping); }
public static void AddTextures() { var GateLeverTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); GateLeverTextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "Lever.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".GateLever", GateLeverTextureMapping); var GateTextureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); GateTextureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "gate.png"; ItemTypesServer.SetTextureMapping(GameLoader.NAMESPACE + ".Gate", GateTextureMapping); }
public static void AfterSelectedWorld() { Pipliz.Log.Write(string.Format("Started loading door texture mappings...")); JSONNode jsonTextureMapping; JSON.Deserialize(Path.Combine(DoorsDirectory, "doorstexturemapping.json"), out jsonTextureMapping, true); if (jsonTextureMapping.NodeType == NodeType.Object) { foreach (KeyValuePair <string, JSONNode> textureEntry in jsonTextureMapping.LoopObject()) { try { foreach (string suffix in new string[] { "", OPEN_SUFFIX }) { ItemTypesServer.TextureMapping textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); string textureTypeValue; if (textureEntry.Value.TryGetAs <string> ("albedo", out textureTypeValue) && !textureTypeValue.Equals("neutral")) { string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "albedo", textureTypeValue + ".png"); Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "albedo", textureTypeValue, realTextureTypeValue)); textureMapping.AlbedoPath = realTextureTypeValue; } if (textureEntry.Value.TryGetAs <string> ("normal", out textureTypeValue) && !textureTypeValue.Equals("neutral")) { string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "normal", textureTypeValue + ".png"); Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "normal", textureTypeValue, realTextureTypeValue)); textureMapping.NormalPath = realTextureTypeValue; } if (textureEntry.Value.TryGetAs <string> ("emissive", out textureTypeValue) && !textureTypeValue.Equals("neutral")) { string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "emissive", textureTypeValue + ".png"); Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "emissive", textureTypeValue, realTextureTypeValue)); textureMapping.EmissivePath = realTextureTypeValue; } if (textureEntry.Value.TryGetAs <string> ("height", out textureTypeValue) && !textureTypeValue.Equals("neutral")) { string realTextureTypeValue = MultiPath.Combine(DoorsDirectory, "textures", "height", textureTypeValue + ".png"); Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", "height", textureTypeValue, realTextureTypeValue)); textureMapping.HeightPath = realTextureTypeValue; } string realkey = MOD_PREFIX + textureEntry.Key + suffix; Pipliz.Log.Write(string.Format("Adding texture mapping for '{0}'", realkey)); ItemTypesServer.SetTextureMapping(realkey, textureMapping); } } catch (Exception exception) { Pipliz.Log.WriteError(string.Format("Exception while loading from {0}; {1}", "doorstexturemapping.json", exception.Message)); } } } }
public static void AddTextures() { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/HerbalistBench.png"; textureMapping.NormalPath = GameLoader.TEXTURE_FOLDER_PANDA + "/normal/HerbalistBench.png"; textureMapping.HeightPath = GameLoader.TEXTURE_FOLDER_PANDA + "/height/HerbalistBench.png"; ItemTypesServer.SetTextureMapping(JOB_ITEM_KEY, textureMapping); ItemTypesServer.SetTextureMapping(HERB1_NAME, new ItemTypesServer.TextureMapping(new JSONNode()) { AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/herbs.png" }); ItemTypesServer.SetTextureMapping(HERB2_NAME, new ItemTypesServer.TextureMapping(new JSONNode()) { AlbedoPath = GameLoader.TEXTURE_FOLDER_PANDA + "/albedo/herbs.png" }); }
public static void AddTextures() { var textureMapping = new ItemTypesServer.TextureMapping(new JSONNode()); textureMapping.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "AirTurret.png"; textureMapping.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; textureMapping.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(AIRTURRET_NAMESPACE + "sides", textureMapping); var earthTexture = new ItemTypesServer.TextureMapping(new JSONNode()); earthTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "EarthTurret.png"; earthTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; earthTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(EARTHTURRET_NAMESPACE + "sides", earthTexture); var fireTexture = new ItemTypesServer.TextureMapping(new JSONNode()); fireTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "FireTurret.png"; fireTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; fireTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(FIRETURRET_NAMESPACE + "sides", fireTexture); var waterTexture = new ItemTypesServer.TextureMapping(new JSONNode()); waterTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "WaterTurret.png"; waterTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; waterTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(WATERTURRET_NAMESPACE + "sides", waterTexture); var voidTexture = new ItemTypesServer.TextureMapping(new JSONNode()); voidTexture.AlbedoPath = GameLoader.BLOCKS_ALBEDO_PATH + "VoidTurret.png"; voidTexture.NormalPath = GameLoader.BLOCKS_NORMAL_PATH + "Turret.png"; voidTexture.HeightPath = GameLoader.BLOCKS_HEIGHT_PATH + "Turret.png"; ItemTypesServer.SetTextureMapping(VOIDTURRET_NAMESPACE + "sides", voidTexture); }
/// <summary> /// Registers this texture in the server database. Should be called during the afterSelectedWorld callback method. /// </summary> public void registerTexture() { Pipliz.Log.Write("{0}: Registering specific texture as {1}", NAMESPACE == null ? "" : NAMESPACE, this.ID); foreach (string S in new List <string> { this.AlbedoPath, this.EmissivePath, this.HeightPath, this.NormalPath }) { if (S != null) { if (System.IO.File.Exists(S)) { Pipliz.Log.Write("{0}: Looks good, albedo file exists.", NAMESPACE == null ? "" : NAMESPACE); } else { Pipliz.Log.WriteError("{0}: ERROR! Registering texture to a file {1} which does not exist!", NAMESPACE == null ? "" : NAMESPACE, S); } } } ItemTypesServer.SetTextureMapping(this.ID, this.asTextureMapping()); Pipliz.Log.Write("{0}: Specific texture registered: {1}", NAMESPACE == null ? "" : NAMESPACE, this.Name); }
public void Register() { JSONNode texture = new JSONNode(); texture.SetAs("albedo", Albedo); if (Emissive != null && Emissive != "") { texture.SetAs("emissive", Emissive); } if (Height != null && Height != "") { texture.SetAs("height", Height); } if (Normal != null && Normal != "") { texture.SetAs("normal", Normal); } ItemTypesServer.SetTextureMapping(Name, new ItemTypesServer.TextureMapping(texture)); }
private static void AddTextureMapping(string path, string sub) { Logger.Log("Update texture mappings..."); if (JSON.Deserialize(path + "/UpdateTextures.json", out JSONNode jsonTextureMapping, false)) { if (jsonTextureMapping.NodeType == NodeType.Object) { foreach (KeyValuePair <string, JSONNode> textureEntry in jsonTextureMapping.LoopObject()) { try { string albedoPath = null; string normalPath = null; string emissivePath = null; string heightPath = null; foreach (string textureType in new string[] { "albedo", "normal", "emissive", "height" }) { string textureTypeValue = textureEntry.Value.GetAs <string>(textureType); string realTextureTypeValue = textureTypeValue; if (!textureTypeValue.Equals("neutral")) { if (textureTypeValue.StartsWith(VANILLA_PREFIX)) { realTextureTypeValue = realTextureTypeValue.Substring(VANILLA_PREFIX.Length); } else { realTextureTypeValue = GameLoader.TextureFolder + "/" + textureType + "/" + sub + textureTypeValue + ".png"; switch (textureType.ToLowerInvariant()) { case "albedo": albedoPath = realTextureTypeValue; break; case "normal": normalPath = realTextureTypeValue; break; case "emissive": emissivePath = realTextureTypeValue; break; case "height": heightPath = realTextureTypeValue; break; } } } textureEntry.Value.SetAs(textureType, realTextureTypeValue); } var textureMapping = new ItemTypesServer.TextureMapping(textureEntry.Value); if (albedoPath != null) { textureMapping.AlbedoPath = albedoPath; } if (normalPath != null) { textureMapping.NormalPath = normalPath; } if (emissivePath != null) { textureMapping.EmissivePath = emissivePath; } if (heightPath != null) { textureMapping.HeightPath = heightPath; } string realkey; if (!textureEntry.Key.StartsWith(VANILLA_PREFIX)) { realkey = Blocks.MOD_NAMESPACE + "." + textureEntry.Key; } else { realkey = textureEntry.Key.Substring(VANILLA_PREFIX.Length); } ItemTypesServer.SetTextureMapping(realkey, textureMapping); Logger.Log("TextureMapping loaded for..." + realkey); } catch (Exception exception) { Logger.Log("Exception while loading from {0}; {1}", "texturemapping.json", exception.Message); } } } else { Logger.Log("Expected json object in {0}, but got {1} instead", "texturemapping.json", jsonTextureMapping.NodeType); } } }
public static void AfterSelectedWorld() { foreach (string fullDirPath in Directory.GetDirectories(BlocksDirectory)) { string packageName = Path.GetFileName(fullDirPath); if (packageName.Equals("examples")) { continue; } Pipliz.Log.Write(string.Format("Started loading '{0}' texture mappings...", packageName)); JSONNode jsonTextureMapping; if (Pipliz.JSON.JSON.Deserialize(MultiPath.Combine(BlocksDirectory, packageName, "texturemapping.json"), out jsonTextureMapping, false)) { if (jsonTextureMapping.NodeType == NodeType.Object) { foreach (KeyValuePair <string, JSONNode> textureEntry in jsonTextureMapping.LoopObject()) { try { string albedoPath = null; string normalPath = null; string emissivePath = null; string heightPath = null; foreach (string textureType in new string[] { "albedo", "normal", "emissive", "height" }) { string textureTypeValue = textureEntry.Value.GetAs <string> (textureType); string realTextureTypeValue = textureTypeValue; if (!textureTypeValue.Equals("neutral")) { if (textureTypeValue.StartsWith(VANILLA_PREFIX)) { realTextureTypeValue = realTextureTypeValue.Substring(VANILLA_PREFIX.Length); } else { realTextureTypeValue = MultiPath.Combine(BlocksDirectory, packageName, "textures", textureType, textureTypeValue + ".png"); if (textureType.Equals("albedo")) { albedoPath = realTextureTypeValue; } else if (textureType.Equals("normal")) { normalPath = realTextureTypeValue; } else if (textureType.Equals("emissive")) { emissivePath = realTextureTypeValue; } else if (textureType.Equals("height")) { heightPath = realTextureTypeValue; } } Pipliz.Log.Write(string.Format("Rewriting {0} texture path from '{1}' to '{2}'", textureType, textureTypeValue, realTextureTypeValue)); } textureEntry.Value.SetAs(textureType, realTextureTypeValue); } var textureMapping = new ItemTypesServer.TextureMapping(textureEntry.Value); if (albedoPath != null) { textureMapping.AlbedoPath = albedoPath; } if (normalPath != null) { textureMapping.NormalPath = normalPath; } if (emissivePath != null) { textureMapping.EmissivePath = emissivePath; } if (heightPath != null) { textureMapping.HeightPath = heightPath; } string realkey = MOD_PREFIX + packageName + "." + textureEntry.Key; Pipliz.Log.Write(string.Format("Adding texture mapping for '{0}'", realkey)); ItemTypesServer.SetTextureMapping(realkey, textureMapping); } catch (Exception exception) { Pipliz.Log.WriteError(string.Format("Exception while loading from {0}; {1}", "texturemapping.json", exception.Message)); } } } else { Pipliz.Log.WriteError(string.Format("Expected json object in {0}, but got {1} instead", "texturemapping.json", jsonTextureMapping.NodeType)); } } } }