Skip to content

Commit

Permalink
update for tml changes (consumeammo, load/save)
Browse files Browse the repository at this point in the history
  • Loading branch information
direwolf420 committed Sep 23, 2021
1 parent e221fb1 commit 92238f6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 49 deletions.
13 changes: 5 additions & 8 deletions AssPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,14 @@ public override void ResetEffects()

public bool LeftClickReleased { get { return PlayerInput.Triggers.JustReleased.MouseLeft; } }

public override TagCompound Save()
public override void SaveData(TagCompound tag)
{
return new TagCompound
{
{"teleportHomeWhenLowTimer", (int)teleportHomeTimer},
{"getDefenseTimer", (int)getDefenseTimer},
{"droneControllerUnlocked", (byte)droneControllerUnlocked}
};
tag.Add("teleportHomeWhenLowTimer", (int)teleportHomeTimer);
tag.Add("getDefenseTimer", (int)getDefenseTimer);
tag.Add("droneControllerUnlocked", (byte)droneControllerUnlocked);
}

public override void Load(TagCompound tag)
public override void LoadData(TagCompound tag)
{
teleportHomeTimer = (short)tag.GetInt("teleportHomeWhenLowTimer");
getDefenseTimer = (short)tag.GetInt("getDefenseTimer");
Expand Down
6 changes: 2 additions & 4 deletions AssWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,15 @@ public override void OnWorldLoad()
droppedHarvesterSpawnItemThisSession = false;
}

public override TagCompound SaveWorldData()
public override void SaveWorldData(TagCompound tag)
{
var downed = new List<string>();
if (downedHarvester)
{
downed.Add("harvester");
}

return new TagCompound {
{"downed", downed}
};
tag.Add("downed", downed);
}

public override void LoadWorldData(TagCompound tag)
Expand Down
49 changes: 23 additions & 26 deletions GitGudPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -848,32 +848,29 @@ public override void Initialize()

//no need for syncplayer because the server handles the item drop stuff

public override TagCompound Save()
{
return new TagCompound
{
{"kingSlimeGitgudCounter", (byte)kingSlimeGitgudCounter},
{"eyeOfCthulhuGitgudCounter", (byte)eyeOfCthulhuGitgudCounter},
{"brainOfCthulhuGitgudCounter", (byte)brainOfCthulhuGitgudCounter},
{"eaterOfWorldsGitgudCounter", (byte)eaterOfWorldsGitgudCounter},
{"queenBeeGitgudCounter", (byte)queenBeeGitgudCounter},
{"skeletronGitgudCounter", (byte)skeletronGitgudCounter},
{"wallOfFleshGitgudCounter", (byte)wallOfFleshGitgudCounter},
{"queenSlimeGitgudCounter", (byte)queenSlimeGitgudCounter},
{"destroyerGitgudCounter", (byte)destroyerGitgudCounter},
{"twinsGitgudCounter", (byte)twinsGitgudCounter},
{"skeletronPrimeGitgudCounter", (byte)skeletronPrimeGitgudCounter},
{"planteraGitgudCounter", (byte)planteraGitgudCounter},
{"empressOfLightGitgudCounter", (byte)empressOfLightGitgudCounter},
{"golemGitgudCounter", (byte)golemGitgudCounter},
{"dukeFishronGitgudCounter", (byte)dukeFishronGitgudCounter},
{"lunaticCultistGitgudCounter", (byte)lunaticCultistGitgudCounter},
{"moonLordGitgudCounter", (byte)moonLordGitgudCounter},
//{"pirateInvasionGitgudCounter", (byte)pirateInvasionGitgudCounter},
};
}

public override void Load(TagCompound tag)
public override void SaveData(TagCompound tag)
{
tag.Add("kingSlimeGitgudCounter", (byte)kingSlimeGitgudCounter);
tag.Add("eyeOfCthulhuGitgudCounter", (byte)eyeOfCthulhuGitgudCounter);
tag.Add("brainOfCthulhuGitgudCounter", (byte)brainOfCthulhuGitgudCounter);
tag.Add("eaterOfWorldsGitgudCounter", (byte)eaterOfWorldsGitgudCounter);
tag.Add("queenBeeGitgudCounter", (byte)queenBeeGitgudCounter);
tag.Add("skeletronGitgudCounter", (byte)skeletronGitgudCounter);
tag.Add("wallOfFleshGitgudCounter", (byte)wallOfFleshGitgudCounter);
tag.Add("queenSlimeGitgudCounter", (byte)queenSlimeGitgudCounter);
tag.Add("destroyerGitgudCounter", (byte)destroyerGitgudCounter);
tag.Add("twinsGitgudCounter", (byte)twinsGitgudCounter);
tag.Add("skeletronPrimeGitgudCounter", (byte)skeletronPrimeGitgudCounter);
tag.Add("planteraGitgudCounter", (byte)planteraGitgudCounter);
tag.Add("empressOfLightGitgudCounter", (byte)empressOfLightGitgudCounter);
tag.Add("golemGitgudCounter", (byte)golemGitgudCounter);
tag.Add("dukeFishronGitgudCounter", (byte)dukeFishronGitgudCounter);
tag.Add("lunaticCultistGitgudCounter", (byte)lunaticCultistGitgudCounter);
tag.Add("moonLordGitgudCounter", (byte)moonLordGitgudCounter);
//tag.Add("pirateInvasionGitgudCounter", (byte)pirateInvasionGitgudCounter);
}

public override void LoadData(TagCompound tag)
{
kingSlimeGitgudCounter = tag.GetByte("kingSlimeGitgudCounter");
eyeOfCthulhuGitgudCounter = tag.GetByte("eyeOfCthulhuGitgudCounter");
Expand Down
2 changes: 1 addition & 1 deletion Items/Weapons/BreathOfSpazmatism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public override void AddRecipes()
CreateRecipe(1).AddIngredient(ItemID.HallowedBar, 5).AddIngredient(ItemID.SoulofSight, 5).AddIngredient(ItemID.Flamethrower, 1).AddTile(TileID.MythrilAnvil).Register();
}

public override bool ConsumeAmmo(Player player)
public override bool CanConsumeAmmo(Player player)
{
return Main.rand.NextFloat() >= .80f; //80% chance not to consume ammo (since its so fast)
}
Expand Down
16 changes: 6 additions & 10 deletions PetPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,11 @@ public bool ThreeTimesUseTime()
return false;
}

public override TagCompound Save()
public override void SaveData(TagCompound tag)
{
TagCompound tag = new TagCompound {
{"slots", (int)slots},
{"color", (int)color},
{"petAccessoryRework", (bool)petAccessoryRework},
};
tag.Add("slots", (int)slots);
tag.Add("color", (int)color);
tag.Add("petAccessoryRework", (bool)petAccessoryRework);

TagCompound petTags = new TagCompound
{
Expand Down Expand Up @@ -306,12 +304,10 @@ public override TagCompound Save()
{ "youngHarpyType", youngHarpyType }
};

tag.Add("petTags", petTags);

return tag;
tag.Add("petTags", petTags);
}

public override void Load(TagCompound tag)
public override void LoadData(TagCompound tag)
{
slots = (uint)tag.GetInt("slots");
color = (uint)tag.GetInt("color");
Expand Down

0 comments on commit 92238f6

Please sign in to comment.