Ancient set & Metal scrap rename

This commit is contained in:
IbanPlay authored and Cameron Ewell committed 2022-07-11 19:05:37 -04:00
1 parent 0cbd8d7952
commit 837c5fd0a0
31 files changed
+158 -36

No files matched your search

+10 -5
View File
@@ -15,14 +15,19 @@ namespace CalamityMod.CalPlayer.DrawLayers
protected override void Draw(ref PlayerDrawSet drawInfo)
{
//Todo : Make this work even for accessories by somehow checking for the players.head equipslot's item instead of the head item.
Player drawPlayer = drawInfo.drawPlayer;
int headItemType = drawPlayer.armor[0].type;
if (drawPlayer.armor[10].type > ItemID.None)
headItemType = drawPlayer.armor[10].type;
Item headItem = drawPlayer.armor[0];
if (ModContent.GetModItem(headItemType) is IExtendedHat extendedHatDrawer)
if (drawPlayer.armor[10].type > ItemID.None)
headItem = drawPlayer.armor[10];
if (ModContent.GetModItem(headItem.type) is IExtendedHat extendedHatDrawer)
{
if (extendedHatDrawer.PreDrawExtension(drawInfo) && !drawInfo.drawPlayer.dead)
string equipSlotName = extendedHatDrawer.EquipSlotName(drawPlayer) != "" ? extendedHatDrawer.EquipSlotName(drawPlayer) : headItem.Name;
int equipSlot = EquipLoader.GetEquipSlot(Mod, equipSlotName, EquipType.Head);
if (extendedHatDrawer.PreDrawExtension(drawInfo) && !drawInfo.drawPlayer.dead && equipSlot == drawPlayer.head)
{
int dyeShader = drawPlayer.dye?[0].dye ?? 0;
+7
View File
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework;
using Terraria.DataStructures;
using Terraria;
public interface IExtendedHat
{
@@ -15,4 +16,10 @@ public interface IExtendedHat
///Return true to make the extension get drawn automatically from the texture and offsets provided. Return false if you want to draw it yourself
/// </summary>
bool PreDrawExtension(PlayerDrawSet drawInfo) => true;
/// <summary>
/// The name of the equip slot for the item. If left empty, the equip slot that is looked for will use the name of the item.
/// Useful if you have multiple head textures you need to extend.
/// </summary>
string EquipSlotName(Player drawPlayer) => "";
}
@@ -0,0 +1,107 @@
using CalamityMod.CalPlayer;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Items.Accessories.Vanity
{
[AutoloadEquip(EquipType.Head)]
public class AbandonnedWulfrumHelmet : ModItem
{
public override void Load()
{
if (Main.netMode != NetmodeID.Server)
{
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonnedWulfrumHelmet_HeadSet", EquipType.Head, name: "WulfrumOldSetHead");
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonnedWulfrumHelmet_Body", EquipType.Body, this);
EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonnedWulfrumHelmet_Legs", EquipType.Legs, this);
}
}
public override void SetStaticDefaults()
{
SacrificeTotal = 1;
DisplayName.SetDefault("Abandonned Wulfrum Helmet");
Tooltip.SetDefault("A worn and rusty helmet ressembling older models of wulfrum armor\n" +
//Could include lore about how X kind of people used to wear it. Like "Streets used to be filled with people of The Resistance wearing this cheap yet effective armor.
"Transforms the holder into a wulfrum robot\n" +
"Can also be worn in the helmet slot as a regular helm");
if (Main.netMode == NetmodeID.Server)
return;
int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head);
ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false;
int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body);
ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true;
ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true;
int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs);
ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true;
}
public override void SetDefaults()
{
Item.width = 26;
Item.height = 30;
Item.accessory = true;
Item.value = CalamityGlobalItem.Rarity1BuyPrice;
Item.rare = ItemRarityID.Green;
Item.vanity = true;
}
public override void UpdateVanity(Player player)
{
player.GetModPlayer<WulfrumTransformationPlayer>().vanityEquiped = true;
}
public override void UpdateAccessory(Player player, bool hideVisual)
{
if (!hideVisual)
player.GetModPlayer<WulfrumTransformationPlayer>().vanityEquiped = true;
}
}
public class WulfrumTransformationPlayer : ModPlayer
{
public bool vanityEquiped = false;
public int hurtSoundTimer;
public override void ResetEffects()
{
vanityEquiped = false;
}
public override void FrameEffects()
{
if (vanityEquiped)
{
Player.legs = EquipLoader.GetEquipSlot(Mod, "AbandonnedWulfrumHelmet", EquipType.Legs);
Player.body = EquipLoader.GetEquipSlot(Mod, "AbandonnedWulfrumHelmet", EquipType.Body);
Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head);
Player.face = -1;
}
}
public override void PostUpdateMiscEffects()
{
if (hurtSoundTimer > 0)
hurtSoundTimer--;
}
public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource)
{
if (vanityEquiped && hurtSoundTimer == 0)
{
playSound = false;
SoundEngine.PlaySound(SoundID.NPCHit4, Player.position);
hurtSoundTimer = 10;
}
return base.PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

+1 -1
View File
@@ -58,7 +58,7 @@ namespace CalamityMod.Items.Accessories
{
CreateRecipe().
AddIngredient(ItemID.Chain, 2).
AddIngredient<WulfrumShard>(6).
AddIngredient<WulfrumMetalScrap>(6).
AddIngredient<EnergyCore>(1).
AddTile(TileID.Anvils).
Register();
+2 -1
View File
@@ -24,6 +24,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
{
public string ExtensionTexture => "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_HeadExtension";
public Vector2 ExtensionSpriteOffset(PlayerDrawSet drawInfo) => -Vector2.UnitY * 2f;
public string EquipSlotName(Player drawPlayer) => drawPlayer.Male ? Name : "WulfrumHatFemale";
public override void Load()
{
@@ -77,7 +78,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(5).
AddIngredient<WulfrumMetalScrap>(5).
AddIngredient<EnergyCore>().
AddTile(TileID.Anvils).
Register();
+1 -1
View File
@@ -37,7 +37,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(12).
AddIngredient<WulfrumMetalScrap>(12).
AddIngredient<EnergyCore>().
AddTile(TileID.Anvils).
Register();
+1 -1
View File
@@ -39,7 +39,7 @@ namespace CalamityMod.Items.Armor.Wulfrum
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(8).
AddIngredient<WulfrumMetalScrap>(8).
AddIngredient<EnergyCore>().
AddTile(TileID.Anvils).
Register();
+2 -2
View File
@@ -257,13 +257,13 @@ namespace CalamityMod.Items
case ItemID.WoodenCrate:
case ItemID.WoodenCrateHard:
BlockCrateDrops();
DropHelper.DropItemChance(s, player, ModContent.ItemType<WulfrumShard>(), 0.25f, 3, 5);
DropHelper.DropItemChance(s, player, ModContent.ItemType<WulfrumMetalScrap>(), 0.25f, 3, 5);
break;
case ItemID.IronCrate:
case ItemID.IronCrateHard:
BlockCrateDrops();
DropHelper.DropItemChance(s, player, ModContent.ItemType<WulfrumShard>(), 0.25f, 5, 8);
DropHelper.DropItemChance(s, player, ModContent.ItemType<WulfrumMetalScrap>(), 0.25f, 5, 8);
DropHelper.DropItemChance(s, player, ModContent.ItemType<AncientBoneDust>(), 0.25f, 5, 8);
break;
+1 -1
View File
@@ -33,7 +33,7 @@ namespace CalamityMod.Items.Fishing.FishingRods
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(9).
AddIngredient<WulfrumMetalScrap>(9).
AddTile(TileID.Anvils).
Register();
}
+1 -1
View File
@@ -4,7 +4,7 @@ using Terraria.ID;
namespace CalamityMod.Items.Materials
{
public class WulfrumShard : ModItem
public class WulfrumMetalScrap : ModItem
{
public override void SetStaticDefaults()
{
+1 -1
View File
@@ -72,7 +72,7 @@ namespace CalamityMod.Items.Tools
{
CreateRecipe().
AddIngredient(ItemID.Gel, 5). //Gel is a default combustible item to fuel the motors of the lil guys
AddIngredient<WulfrumShard>(3).
AddIngredient<WulfrumMetalScrap>(3).
Register();
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ namespace CalamityMod.Items.Tools
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(8).
AddIngredient<WulfrumMetalScrap>(8).
AddTile(TileID.Anvils).
Register();
}
+2 -2
View File
@@ -54,7 +54,7 @@ namespace CalamityMod.Items.Tools
public override bool CanUseItem(Player player)
{
return (storedScrap > 0 || player.HasItem(ModContent.ItemType<WulfrumShard>())) && !player.noBuilding
return (storedScrap > 0 || player.HasItem(ModContent.ItemType<WulfrumMetalScrap>())) && !player.noBuilding
&& !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && n.type == Item.shoot);
}
@@ -110,7 +110,7 @@ namespace CalamityMod.Items.Tools
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(6).
AddIngredient<WulfrumMetalScrap>(6).
AddIngredient<EnergyCore>(1).
AddTile(TileID.Anvils).
Register();
+2 -2
View File
@@ -80,7 +80,7 @@ namespace CalamityMod.Items.Tools
if (timeBeforeBlast <= 0)
{
DropHelper.DropItem(Item.GetSource_ItemUse(Item), player, ModContent.ItemType<WulfrumShard>(), 0, 3);
DropHelper.DropItem(Item.GetSource_ItemUse(Item), player, ModContent.ItemType<WulfrumMetalScrap>(), 0, 3);
Item.TurnToAir();
@@ -282,7 +282,7 @@ namespace CalamityMod.Items.Tools
{
//Intentionally craftable anywhere.
CreateRecipe().
AddIngredient<WulfrumShard>(6).
AddIngredient<WulfrumMetalScrap>(6).
Register();
}
}
+1 -1
View File
@@ -154,7 +154,7 @@ namespace CalamityMod.Items.Weapons.Magic
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(12).
AddIngredient<WulfrumMetalScrap>(12).
AddTile(TileID.Anvils).
Register();
}
+1 -1
View File
@@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(12).
AddIngredient<WulfrumMetalScrap>(12).
AddTile(TileID.Anvils).
Register();
}
+5 -5
View File
@@ -64,12 +64,12 @@ namespace CalamityMod.Items.Weapons.Ranged
player.Calamity().mouseWorldListener = true;
}
public override bool CanUseItem(Player player) => storedScrap > 0 || (player.HasItem(ModContent.ItemType<WulfrumShard>()) || player.HasItem(ItemID.SilverCoin));
public override bool CanUseItem(Player player) => storedScrap > 0 || (player.HasItem(ModContent.ItemType<WulfrumMetalScrap>()) || player.HasItem(ItemID.SilverCoin));
public override void UseAnimation(Player player)
{
Item.UseSound = ShootSound;
if (storedScrap == 1 && (player.HasItem(ModContent.ItemType<WulfrumShard>()) || player.HasItem(ItemID.SilverCoin)))
if (storedScrap == 1 && (player.HasItem(ModContent.ItemType<WulfrumMetalScrap>()) || player.HasItem(ItemID.SilverCoin)))
Item.UseSound = ShootAndReloadSound;
}
@@ -81,9 +81,9 @@ namespace CalamityMod.Items.Weapons.Ranged
{
bool ammoConsumed = false;
if (player.HasItem(ModContent.ItemType<WulfrumShard>()))
if (player.HasItem(ModContent.ItemType<WulfrumMetalScrap>()))
{
player.ConsumeItem(ModContent.ItemType<WulfrumShard>());
player.ConsumeItem(ModContent.ItemType<WulfrumMetalScrap>());
ammoConsumed = true;
}
@@ -186,7 +186,7 @@ namespace CalamityMod.Items.Weapons.Ranged
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(10).
AddIngredient<WulfrumMetalScrap>(10).
AddTile(TileID.Anvils).
Register();
}
+1 -1
View File
@@ -153,7 +153,7 @@ namespace CalamityMod.Items.Weapons.Rogue
public override void AddRecipes()
{
CreateRecipe(100).
AddIngredient<WulfrumShard>().
AddIngredient<WulfrumMetalScrap>().
Register();
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Summon
public override void AddRecipes()
{
CreateRecipe().
AddIngredient<WulfrumShard>(9).
AddIngredient<WulfrumMetalScrap>(9).
AddTile(TileID.Anvils).
Register();
}
+1 -1
View File
@@ -221,7 +221,7 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<WulfrumShard>(), 1, 1, 3);
npcLoot.Add(ModContent.ItemType<WulfrumMetalScrap>(), 1, 1, 3);
npcLoot.Add(ModContent.ItemType<WulfrumBattery>(), new Fraction(7, 100));
npcLoot.AddIf(info => info.npc.ModNPC<WulfrumDrone>().Supercharged, ModContent.ItemType<EnergyCore>());
}
+1 -1
View File
@@ -201,7 +201,7 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<WulfrumShard>(), 1, 1, 2);
npcLoot.Add(ModContent.ItemType<WulfrumMetalScrap>(), 1, 1, 2);
npcLoot.Add(ModContent.ItemType<WulfrumBattery>(), new Fraction(7, 100));
npcLoot.AddIf(info => info.npc.ModNPC<WulfrumGyrator>().Supercharged, ModContent.ItemType<EnergyCore>());
}
+1 -1
View File
@@ -297,7 +297,7 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<WulfrumShard>(), 1, 2, 3);
npcLoot.Add(ModContent.ItemType<WulfrumMetalScrap>(), 1, 2, 3);
npcLoot.Add(ModContent.ItemType<WulfrumBattery>(), new Fraction(7, 100));
npcLoot.AddIf(info => info.npc.ModNPC<WulfrumHovercraft>().Supercharged, ModContent.ItemType<EnergyCore>());
}
+3 -1
View File
@@ -1,4 +1,5 @@
using CalamityMod.Items.Accessories;
using CalamityMod.Items.Accessories.Vanity;
using CalamityMod.Items.Materials;
using CalamityMod.Items.Placeables.Banners;
using Terraria;
@@ -199,8 +200,9 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<WulfrumShard>(), 1, 2, 3);
npcLoot.Add(ModContent.ItemType<WulfrumMetalScrap>(), 1, 2, 3);
npcLoot.Add(ModContent.ItemType<WulfrumBattery>(), new Fraction(7, 100));
npcLoot.Add(ModContent.ItemType<AbandonnedWulfrumHelmet>(), new Fraction(5, 100));
npcLoot.Add(ModContent.ItemType<EnergyCore>());
}
}
+1 -1
View File
@@ -179,7 +179,7 @@ namespace CalamityMod.NPCs.NormalNPCs
public override void ModifyNPCLoot(NPCLoot npcLoot)
{
npcLoot.Add(ModContent.ItemType<WulfrumShard>(), 1, 1, 2);
npcLoot.Add(ModContent.ItemType<WulfrumMetalScrap>(), 1, 1, 2);
npcLoot.Add(ModContent.ItemType<RoverDrive>(), 10);
npcLoot.Add(ModContent.ItemType<WulfrumBattery>(), new Fraction(7, 100));
npcLoot.AddIf(info => info.npc.ModNPC<WulfrumRover>().Supercharged, ModContent.ItemType<EnergyCore>());
@@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Typeless
if (Main.myPlayer == Owner.whoAmI)
{
if (Main.rand.NextBool() && !Projectile.noDropItem)
Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType<WulfrumShard>(), Main.rand.Next(0, 3));
Item.NewItem(Projectile.GetSource_DropAsItem(), (int)Projectile.position.X, (int)Projectile.position.Y, Projectile.width, Projectile.height, ModContent.ItemType<WulfrumMetalScrap>(), Main.rand.Next(0, 3));
}
if (SoundEngine.TryGetActiveSound(CuttingSoundSlot, out var cuttingSoundOut))
@@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Typeless
public Player Owner => Main.player[Projectile.owner];
public WulfrumScaffoldKit Kit => Owner.HeldItem.ModItem as WulfrumScaffoldKit;
public bool CanOwnerGoOn => Kit.storedScrap > 0 || Owner.HasItem(ModContent.ItemType<WulfrumShard>());
public bool CanOwnerGoOn => Kit.storedScrap > 0 || Owner.HasItem(ModContent.ItemType<WulfrumMetalScrap>());
public bool CanSelectTile(Point tilePos)
{
@@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Typeless
else
{
Owner.ConsumeItem(ModContent.ItemType<WulfrumShard>());
Owner.ConsumeItem(ModContent.ItemType<WulfrumMetalScrap>());
Kit.storedScrap = WulfrumScaffoldKit.TilesPerScrap - 1;
SoundEngine.PlaySound(SoundID.Item65);
if (Main.netMode != NetmodeID.Server)