Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Fishing Crate stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsukino-uwu committed Jun 10, 2020
1 parent 841ebce commit 5637d33
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 22 deletions.
Binary file modified .vs/NekoTweakMod/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file modified .vs/NekoTweakMod/v16/.suo
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Terraria;
using Terraria.ModLoader;
namespace NekoTweakMod.Items.Fishing
namespace NekoTweakMod.Fishing
{
public class AddItemToCrate : GlobalItem
{
Expand Down
46 changes: 46 additions & 0 deletions Fishing/AddModdedCrateToForest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Terraria;
using Terraria.ModLoader;
using static Terraria.ModLoader.ModContent;
namespace NekoTweakMod.Fishing

{
public class AddModdedCrateToForest : ModPlayer
{
public static bool PlayerIsInForest(Player player) // Technically, the Forest biome doesn't have an ID. It's the default biome when no other biomes are present.
{
return !player.ZoneJungle
&& !player.ZoneDungeon
&& !player.ZoneCorrupt
&& !player.ZoneCrimson
&& !player.ZoneHoly
&& !player.ZoneSnow
&& !player.ZoneUndergroundDesert
&& !player.ZoneGlowshroom
&& !player.ZoneMeteor
&& !player.ZoneBeach
&& player.ZoneOverworldHeight;

}
public override void CatchFish(Item fishingRod, Item bait, int power, int liquidType, int poolSize, int worldLayer, int questFish, ref int caughtType, ref bool junk)
{
if (liquidType == 2 && Main.rand.Next(1) == 0) // if hardmode
// Liquid types, 0 is water, 1 is lava, 2 is honey
// Main.rand.Next(1) == 0) is the catch % chance to catch the Crate
// n/100 chance or 1 = 100%
{
caughtType = ItemType<ForestCrate>();
}
{
if (liquidType == 2 && Main.rand.Next(1) == 0) // if prehardmode
{
caughtType = ItemType<ForestCrate>();
}
}
}
}
}
/*
Main.rand.Next(1) == 0)
Main.rand.NextBool(97)
^^how do these even work~
*/
2 changes: 1 addition & 1 deletion Items/Fishing/FishingRods.cs → Fishing/FishingRods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Terraria;
using Terraria.ModLoader;

namespace NekoTweakMod.Items.Fishing
namespace NekoTweakMod.Fishing
{
public class FishingRods : GlobalItem // class name & vanilla hook
{
Expand Down
58 changes: 58 additions & 0 deletions Fishing/ForestCrate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using Terraria.ModLoader;
using Terraria.ID;
using static Terraria.ModLoader.ModContent;
using Terraria;

namespace NekoTweakMod.Fishing // where this file is located in the mods folders
{
public class ForestCrate : ModItem // Here we are setting up the crate as an item while in the players inventory, and making it so it creates a tile when placed
{
public override void SetStaticDefaults() // Allows us to set/change a modded items name/translations
{
DisplayName.SetDefault("Forest Crate"); // Changes the item name
Tooltip.SetDefault("{$CommonItemTooltip.RightClickToOpen}"); // Changes items tooltip
}
public override void SetDefaults()
{
item.width = 12;
item.height = 12; // 16 = default, if no value is set
item.maxStack = 99; // how many of the item the player can have in 1 slot in their inventory
item.useTurn = true; // Whether the player can turn around while the using animation is happening.
item.useAnimation = 15; // how fast the animation happens
item.useTime = 15; // how long the animation takes
item.useStyle = ItemUseStyleID.SwingThrow; // how the animation will look
item.autoReuse = true; // will keep on swinging the item when trying to place it
item.consumable = true; // if doing something with the item consumes/removes it
item.value = Item.sellPrice(0, 1, 0, 0); ; // sets the sale/purchase value of the item ( plat,gold,silver,copper)
item.rare = ItemRarityID.Green; // sets the rarity of the item
item.createTile = TileType<Fishing.ForestCratePlaced>(); // where the class is located in the namespace, where file is located in the mod folders~
// for NekoTweakMod this is located in the Tiles folder
}
public override bool CanRightClick()
{
return true;
}
public override void RightClick(Player player)
{
int choice = Main.rand.Next(7);
if (choice == 0)
{
player.QuickSpawnItem(ItemID.Bunny);
}
else if (choice == 1)
{
player.QuickSpawnItem(ItemID.Swordfish);
}
if (choice != 1)
{
player.QuickSpawnItem(ItemID.Meowmere);
}
player.QuickSpawnItem(ItemID.IronBar);
}
}
}

// if (Main.hardMode)
// ItemID.Sets.IsFishingCrateHardmode
// public static bool[] IsFishingCrate = ItemID.Sets.Factory.CreateBoolSet(2334, 2335, 2336, 3203, 3204, 3205, 3206, 3207, 3208, 4405, 4407, 4877, 5002, 3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 4406, 4408, 4878, 5003);
// public static bool[] IsFishingCrateHardmode = ItemID.Sets.Factory.CreateBoolSet(3979, 3980, 3981, 3982, 3983, 3984, 3985, 3986, 3987, 4406, 4408, 4878, 5003);
File renamed without changes
26 changes: 6 additions & 20 deletions Items/Fishing/ModdedCrate.cs → Fishing/ForestCratePlaced.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
/*
using Terraria.ObjectData;
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Terraria.ID;
using static Terraria.ModLoader.ModContent;


namespace NekoTweakMod.Items.Fishing
// In this .cs file we are making a modded item,tile,placeable item & adding it to a fishing spot in a specific biome
// if you want/need something specific from here just check where the classes start/end
namespace NekoTweakMod.Fishing // // where this file is located in the mods folders
{
public class ModdedCrate : ModTile // Here we are setting up everything for the tile
public class ForestCratePlaced : ModTile // Here we are setting up everything for the tile while the item is placed
{
public override void SetDefaults()
{
Expand All @@ -20,11 +16,11 @@ public override void SetDefaults()
Main.tileNoAttach[Type] = true;
Main.tileTable[Type] = true; // if the tile counts as a table inside for a npc house
Main.tileLavaDeath[Type] = true; // if the tile will break when it comes in contact with lava
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); // copies data for how wide/tall the tile will
TileObjectData.newTile.CoordinateHeights = new[] { 18 }; // sets how high up the tile will appear
TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); // 2wide x 2tall
TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; // absoluteAquarian: each number is how tall each "ROW OF TILES" in the "SPRITESHEET" is
TileObjectData.addTile(Type);
ModTranslation name = CreateMapEntryName(); // creates a "name" for the modded tile
name.SetDefault("ExampleCrate"); // Sets the name to "ExampleCrate"
name.SetDefault("Forest Crate"); // Sets the item name to "Forest Crate"
// AddMapEntry(new Color(200, 200, 200), name);
// adds a new color with the rbg values 0-255,0-255,0-255 to the tile with the "name"
// dustType = DustType<Sparkle>(); // mehh fk dust for now~
Expand All @@ -33,17 +29,7 @@ public override void SetDefaults()
}
public override void KillMultiTile(int i, int j, int frameX, int frameY) // makes it possible to set/change what happens when a tile break
{
//Item.NewItem(i * 16, j * 16, 32, 16, ItemType<Items.Fishing.ModdedCrate.PlacableCrate.>());
}
}
public class PlaceableModdedCrate : ModItem
{
public override void SetStaticDefaults() // Allows us to set/change a modded items name/translations
{
Tooltip.SetDefault("ExampleCrate");
Item.NewItem(i * 16, j * 16, 32, 16, ItemType<Fishing.ForestCrate>()); // where the class is located in the namespace, where file is located in the mod folders~
}
}
}
// WIP CODE
*/
Binary file added Fishing/ForestCratePlaced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ might do a modded "forest" crate as well

**Item/crafting related:**

- Hellforge,Adamantite Forge & Titanium Forge now also work like demon/crimson altars for crafting

- Cell phone now makes a portal like "potion of return" when you go back home
(Recall & Return potions still have a faster "use time" to keep them useful)
(On/off toggle in game QoL)
Expand Down
Binary file modified obj/Debug/net45/NekoTweakMod.csprojAssemblyReference.cache
Binary file not shown.

0 comments on commit 5637d33

Please sign in to comment.