Beginner Modding Question - Summon item not working? (Instant Pirate Spawn)

Candiescence

Terrarian
Sorry for the trouble, all; I can't seem to figure this out.
I'm trying to make an instant pirate event spawner (so the 60 second wait time goes away), and it's not working at all...
Here's the code (haven't figured out the IList type to call the vanilla sprite yet):
using Terraria.ID;
using Microsoft.Xna.Framework;
using Terraria;
using System;
using Terraria.ModLoader;

namespace InstantPirateMap.Items
{
public class InstantPirateMap : ModItem
{
public override void SetStaticDefaults()
{
// DisplayName.SetDefault("Test"); // By default, capitalization in classnames will add spaces to the display name. You can customize the display name here by uncommenting this line.
item.CloneDefaults(ItemID.PirateMap);
Tooltip.SetDefault("Instantly spawns the Pirate Invasion");
}

public override void SetDefaults()
{
item.consumable = true;
item.width = 40;
item.height = 40;
item.useTime = 20;
item.useAnimation = 20;
item.useStyle = 4;
item.value = 100;
item.rare = 2;
item.spawnTime = 60;
}

public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(ItemID.PirateMap, 1);
recipe.AddTile(TileID.WorkBenches);
recipe.SetResult(this);
recipe.AddRecipe();
}
}
}

My biggest point of confusion is that the item is flagged as consumable, but does not get consumed? I Tried removing the item.spawnTime parameter (since I'm not even sure if it's the right one - the Item Attributes wiki doesn't list the event delay parameter) and also moving the item.CloneDefaults parameter to the "SetDefaults" Section, but it still didn't work or consume the item.

At the very least, I'm glad I got TModLoader to stop barking at me for all the issues in the code I originally used.

Thank you!!
 

Attachments

  • InstantPirateMap.cs
    146 bytes · Views: 79
Back
Top Bottom