/// <summary> /// Registers a new ElementItem. /// </summary> /// <param name="name">The enum Element value for this item.</param> /// <param name="description">The tooltip for this item.</param> /// <param name="recipe">The recipe for this item.</param> /// <param name="stackCrafted">How much of this item is crafted per recipe.</param> /// <param name="defaults">The defaults set for this item's <seealso cref="Item"/> item field.</param> /// <param name="state">The default ElementState for this element.</param> /// <param name="family">What periodic family this element belongs to.</param> /// <param name="boilingPoint">The boiling point for this element in Kelvin.</param> /// <param name="meltingPoint">The melting point for this element in Kelvin.</param> /// <param name="gasColor">Optional. Determines the colour for the gas drawn for this element when in the world.</param> /// <param name="liquid">Optional. The ModLiquid for this element.</param> /// <param name="isPlaceableBar">Optional. Determines if this metal element is a placeable bar.</param> internal static void RegisterElement(Element name, string description, Action <ModRecipe> recipe, int stackCrafted, Action <Item> defaults, ElementState state, ElementFamily family, float boilingPoint, float meltingPoint, Color?gasColor = null, ModLiquid liquid = null, bool isPlaceableBar = false) { string internalName = ElementName(name); ElementItem item = new ElementItem(name, description, state, family, gasColor ?? Color.White, isPlaceableBar, liquid, boilingPoint, meltingPoint ); mod.AddItem(internalName, item); //Add the corresponding bar tile if it should exist if (isPlaceableBar) { mod.AddTile(internalName, new ScienceBar(), $"TerraScience/Content/Tiles/{internalName}"); } //Cache the defaults and recipe so we can use it anytime TerraScience.CachedElementDefaults.Add(internalName, defaults); TerraScience.CachedElementRecipes.Add(internalName, (r, e) => { recipe(r); r.SetResult(e, stackCrafted); r.AddRecipe(); }); }
public void Load(Mod mod) { Add("Bathtub", new GenericBathtub(color, dust, name + "Bathtub"), mod, 14); Add("Bed", new GenericBed(color, dust, name + "Bed"), mod, 15); Add("Bookcase", new GenericBookcase(color, dust, name + "Bookcase"), mod, 20); Add("Candelabra", new GenericCandelabra(glowColor, dust, name + "Candelabra"), mod, 5); Add("Candle", new GenericCandle(glowColor, dust, name + "Candle"), mod, 4); Add("Chair", new GenericChair(color, dust, name + "Chair"), mod, 4); Add("Chandelier", new GenericChandelier(glowColor, dust, name + "Chandelier"), mod, 4); Add("Clock", new GenericClock(color, dust, name + "Clock"), mod, 10); Add("Dresser", new Generic3x2(color, dust, name + "Dresser"), mod, 16); Add("Lamp", new GenericLamp(glowColor, dust, name + "Lamp"), mod, 3); Add("Lantern", new GenericLantern(glowColor, dust, name + "Lantern"), mod, 6); Add("Piano", new Generic3x2(color, dust, name + "Piano"), mod, 15); Add("Sink", new GenericSink(color, dust, name + "Sink"), mod, 6); Add("Sofa", new Generic3x2(color, dust, name + "Sofa"), mod, 5); Add("Table", new GenericSolidWithTop(color, dust, name + "Table"), mod, 8); Add("Workbench", new GenericWorkbench(color, dust, name + "Workbench"), mod, 10); //special stuff for the door mod.AddTile(name + "DoorClosed", new GenericDoorClosed(color, dust, name + "DoorClosed"), path + name + "DoorClosed"); mod.AddTile(name + "DoorOpen", new GenericDoorOpen(color, dust, name + "DoorOpen"), path + name + "DoorOpen"); mod.AddItem(name + "Door", new GenericFurnitureItem(name + " " + "DoorClosed", path + name + "DoorItem", 6, material)); }
/// <summary> /// Registers a new CompoundItem. /// </summary> /// <param name="compound">The enum Compound value for this item.</param> /// <param name="description">The tooltip for this item.</param> /// <param name="recipe">The recipe for this item.</param> /// <param name="stackCrafted">How much of this item is crafted per recipe.</param> /// <param name="defaults">The defaults set for this item's <seealso cref="Item"/> item field.</param> /// <param name="state">The default ElementState for this compound.</param> /// <param name="boilingPoint">The boiling point for this compound in Kelvin. Set to -1 for "unstable".</param> /// <param name="meltingPoint">The melting point for this compound in Kelvin. Set to -1 for "unstable".</param> /// <param name="elements">The Action for adding elements to this compound's recipe.</param> /// <param name="gasColor">Optional. Determines the colour for the gas drawn for this element when in the world.</param> /// <param name="liquid">Optional. The ModLiquid for this element.</param> /// <param name="isPlaceableBar">Optional. Determines if this metal element is a placeable bar.</param> internal static void RegisterCompound(Compound compound, string description, Action <ModRecipe> recipe, int stackCrafted, Action <Item> defaults, ElementState state, CompoundClassification classification, float boilingPoint, float meltingPoint, Action <CompoundItem> elements, Color?gasColor = null, ModLiquid liquid = null, bool isPlaceableBar = false) { string internalName = CompoundName(compound, false); CompoundItem item = new CompoundItem(compound, description, state, classification, gasColor ?? Color.White, isPlaceableBar, liquid, boilingPoint, meltingPoint, elements); mod.AddItem(internalName, item); //Add the corresponding bar tile if it should exist // TODO: make a ScienceBar for compounds if (isPlaceableBar) { mod.AddTile(internalName, new ScienceBar(), $"TerraScience/Content/Tiles/{internalName}"); } //Cache the defaults and recipe so we can use it anytime TerraScience.CachedCompoundDefaults.Add(internalName, defaults); TerraScience.CachedCompoundRecipes.Add(internalName, (r, e) => { recipe(r); for (int i = 0; i < item.Elements.Count; i++) { Tuple <Element, int> pair = item.Elements[i]; r.AddIngredient(mod.ItemType(ElementUtils.ElementName(pair.Item1)), pair.Item2); } r.SetResult(e, stackCrafted); r.AddRecipe(); }); }
public void LoadTile(string internalName, string displayName, TileLoadData data) { mod.AddItem(internalName + "Item", new QuickTileItem(displayName, "", internalName, 0, AssetRoot + internalName + "Item", true)); mod.AddTile(internalName, new LoaderTile(data, data.dropType == -1 ? mod.ItemType(internalName + "Item") : data.dropType), AssetRoot + internalName); }
private void Add(string typename, ModTile tile, Mod mod, int craftingQuantity) { mod.AddTile(name + typename, tile, path + name + typename); mod.AddItem(name + typename, new GenericFurnitureItem(name + " " + typename, path + name + typename + "Item", craftingQuantity, material)); }