Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
d8c4649f92
|
|||
dd5f7256fc
|
|||
5b1a55973b
|
@ -24,8 +24,8 @@ pipeline:
|
||||
unzip -q TML.Patcher.zip -d TMLPatcher
|
||||
- |
|
||||
rm -f /root/.steam/steamapps/workshop/content/1281930/2563309347/workshop.json
|
||||
VER=$(ls /root/.steam/steamapps/workshop/content/1281930/2563309347 | cut -c 6- | sort | head -n 1)
|
||||
YEAR=$(ls /root/.steam/steamapps/workshop/content/1281930/2563309347 | cut -c -4 | sort | head -n 1)
|
||||
YEAR=$(ls /root/.steam/steamapps/workshop/content/1281930/2563309347 | cut -c -4 | sort -nr | head -n 1)
|
||||
VER=$(find /root/.steam/steamapps/workshop/content/1281930/2563309347/ -type d -name "$YEAR.*" -printf "%f\n" | cut -c 6- | sort -nr | head -n 1)
|
||||
cp /root/.steam/steamapps/workshop/content/1281930/2563309347/$YEAR.$VER/MagicStorage.tmod ./
|
||||
- dotnet TMLPatcher/TML.Patcher.dll extract MagicStorage.tmod
|
||||
- cp MagicStorage/MagicStorage.dll $CI_WORKSPACE/
|
||||
|
@ -21,12 +21,12 @@ namespace MagicStorageVoidBag.Hooks {
|
||||
|
||||
var bag = (MSVoidBag)i.ModItem;
|
||||
|
||||
if (bag.location.X < 0 || bag.location.Y < 0) goto original;
|
||||
if (bag.Location.X < 0 || bag.Location.Y < 0) goto original;
|
||||
|
||||
Tile tile = Main.tile[bag.location.X, bag.location.Y];
|
||||
Tile tile = Main.tile[bag.Location.X, bag.Location.Y];
|
||||
|
||||
if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original;
|
||||
if (!TileEntity.ByPosition.TryGetValue(bag.location, out TileEntity te)) goto original;
|
||||
if (!TileEntity.ByPosition.TryGetValue(bag.Location, out TileEntity te)) goto original;
|
||||
if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original;
|
||||
|
||||
TEStorageHeart heart = (TEStorageHeart)te;
|
||||
|
@ -24,12 +24,12 @@ namespace MagicStorageVoidBag.Hooks {
|
||||
|
||||
var bag = (MSVoidBag)i.ModItem;
|
||||
|
||||
if (bag.location.X < 0 || bag.location.Y < 0) goto original;
|
||||
if (bag.Location.X < 0 || bag.Location.Y < 0) goto original;
|
||||
|
||||
Tile tile = Main.tile[bag.location.X, bag.location.Y];
|
||||
Tile tile = Main.tile[bag.Location.X, bag.Location.Y];
|
||||
|
||||
if (!tile.HasTile || tile.TileType != ModContent.TileType<StorageHeart>() || tile.TileFrameX != 0 || tile.TileFrameY != 0) goto original;
|
||||
if (!TileEntity.ByPosition.TryGetValue(bag.location, out TileEntity te)) goto original;
|
||||
if (!TileEntity.ByPosition.TryGetValue(bag.Location, out TileEntity te)) goto original;
|
||||
if (te.type != ModContent.TileEntityType<TEStorageHeart>()) goto original;
|
||||
|
||||
if (Utility.HeartHasSpaceFor(newItem, (TEStorageHeart)te)) return true;
|
||||
|
@ -1,21 +1,15 @@
|
||||
using MagicStorage.Items;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Terraria;
|
||||
using Terraria.DataStructures;
|
||||
using Terraria.GameContent.Creative;
|
||||
using Terraria.ID;
|
||||
using Terraria.Localization;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.ModLoader.IO;
|
||||
|
||||
namespace MagicStorageVoidBag.Items {
|
||||
[ExtendsFromMod("MagicStorage")]
|
||||
public class MSVoidBag : PortableAccess {
|
||||
[CloneByReference]
|
||||
internal Dictionary<string, Point16> locationsByWorld = new();
|
||||
|
||||
public override void SetStaticDefaults() {
|
||||
CreativeItemSacrificesCatalog.Instance.SacrificeCountNeededByItemId[Type] = 1;
|
||||
@ -30,16 +24,13 @@ namespace MagicStorageVoidBag.Items {
|
||||
Item.useAnimation = 28;
|
||||
Item.useTime = 28;
|
||||
Item.value = Item.sellPrice(gold: 10);
|
||||
|
||||
location = Point16.NegativeOne;
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
}
|
||||
|
||||
public override void ModifyTooltips(List<TooltipLine> lines) {
|
||||
bool isSet = location.X >= 0 && location.Y >= 0;
|
||||
bool isSet = Location.X >= 0 && Location.Y >= 0;
|
||||
for (int k = 0; k < lines.Count; k++)
|
||||
if (isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip1") {
|
||||
lines[k].Text = Language.GetTextValue("Mods.MagicStorage.SetTo", location.X, location.Y);
|
||||
lines[k].Text = Language.GetTextValue("Mods.MagicStorage.SetTo", Location.X, Location.Y);
|
||||
} else if (!isSet && lines[k].Mod == "Terraria" && lines[k].Name == "Tooltip2") {
|
||||
lines.RemoveAt(k);
|
||||
k--;
|
||||
@ -52,55 +43,5 @@ namespace MagicStorageVoidBag.Items {
|
||||
recipe.AddIngredient(ItemID.VoidLens);
|
||||
recipe.Register();
|
||||
}
|
||||
|
||||
public override void UpdateInventory(Player player) {
|
||||
if (!locationsByWorld.ContainsKey(Main.worldName) || location != locationsByWorld[Main.worldName]) {
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
if (Main.netMode == NetmodeID.MultiplayerClient) {
|
||||
int p = Array.IndexOf(Main.player, player);
|
||||
int i = Array.IndexOf(player.inventory, Item);
|
||||
if (p >= 0 && i >= 0) {
|
||||
NetMessage.SendData(MessageID.SyncEquipment, -1, -1, null, p, i, player.inventory[i].prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void SaveData(TagCompound tag) {
|
||||
tag["X"] = location.X;
|
||||
tag["Y"] = location.Y;
|
||||
|
||||
tag["version"] = SAVE_VERSION;
|
||||
|
||||
tag["locations"] = locationsByWorld
|
||||
.Select(kvp => new TagCompound() {
|
||||
["world"] = kvp.Key,
|
||||
["X"] = kvp.Value.X,
|
||||
["Y"] = kvp.Value.Y
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public override void LoadData(TagCompound tag) {
|
||||
if (tag.GetInt("version") < SAVE_VERSION || tag.GetList<TagCompound>("locations") is not List<TagCompound> locations) {
|
||||
location = new Point16(tag.GetShort("X"), tag.GetShort("Y"));
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
} else {
|
||||
locationsByWorld = locations.ToDictionary(t => t.GetString("world"), t => new Point16(t.GetShort("X"), t.GetShort("Y")));
|
||||
if (locationsByWorld.ContainsKey(Main.worldName)) {
|
||||
location = locationsByWorld[Main.worldName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void NetSend(BinaryWriter writer) {
|
||||
writer.Write(location.X);
|
||||
writer.Write(location.Y);
|
||||
}
|
||||
|
||||
public override void NetReceive(BinaryReader reader) {
|
||||
location = new Point16(reader.ReadInt16(), reader.ReadInt16());
|
||||
locationsByWorld[Main.worldName] = location;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user