This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Jungle mimic & fixed pre/hardmode crate
- Loading branch information
1 parent
9ce1d5e
commit 143644c
Showing
11 changed files
with
192 additions
and
22 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Terraria.ID; | ||
using Terraria; | ||
using Terraria.ModLoader; | ||
|
||
namespace NekoTweakMod.Items | ||
{ | ||
public class AddLootToNPC : GlobalNPC // class name & global npc hook, allows us to change properties of NPCs/Mobs | ||
{ | ||
public override void NPCLoot(NPC npc) // allows you to change what happens when an npc dies, in this case we are adding loot | ||
{ | ||
if (npc.type == NPCID.BigMimicJungle)// && NPC.downedGolemBoss) // if the npc type is this specific npc & golem has been defated | ||
{ | ||
// "number/100" or 1 = 1% chance & Itemid Specifies the item to give to the player | ||
if (Main.rand.NextBool(33, 100)) // 33% or 33/100 chance to drop | ||
{ | ||
Item.NewItem(npc.getRect(), ItemID.SpikyBallTrap, 15); // adds the specified itemid as a new loot/drop for the npc and makes 15 of the item drop at once | ||
} | ||
if (Main.rand.NextBool(33, 100)) | ||
{ | ||
Item.NewItem(npc.getRect(), ItemID.FlameTrap, 15); | ||
} | ||
if (Main.rand.NextBool(33, 100)) | ||
{ | ||
Item.NewItem(npc.getRect(), ItemID.SpearTrap, 15); | ||
} | ||
if (Main.rand.NextBool(33, 100)) | ||
{ | ||
Item.NewItem(npc.getRect(), ItemID.SuperDartTrap, 15); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
using Terraria; | ||
using Terraria.ID; | ||
using Terraria.ModLoader; | ||
|
||
namespace NekoTweakMod.NPCs | ||
// need to add few more explanations for stuffs, don't understand everything in here~ | ||
{ | ||
// Code for Spawning/summoning a Jungle Mimic when a Temple Key is placed in a chest | ||
public class JungleMimicChestSummon : ModPlayer | ||
{ | ||
public int LastChest; // sets up a integer named "LastChest" | ||
|
||
public override void PreUpdateBuffs() // This is called before buff updates to the player happens | ||
{ // chest check | ||
if (Main.netMode != NetmodeID.MultiplayerClient) | ||
{ | ||
if (player.chest == -1 && LastChest >= 0 && Main.chest[LastChest] != null) // checks if the last chest used was empty when closed | ||
{ | ||
int x2 = Main.chest[LastChest].x; | ||
int y2 = Main.chest[LastChest].y; | ||
ChestItemSummonCheck(x2, y2, mod); | ||
} | ||
LastChest = player.chest; | ||
} | ||
} | ||
|
||
public override void UpdateAutopause() | ||
// Allows the mimic to spawn in single player while autopause is on | ||
{ | ||
LastChest = player.chest; | ||
} | ||
// The actuall code for summoning/spawning a npc when an item is left in a chest | ||
public static bool ChestItemSummonCheck(int x, int y, Mod mod) | ||
{ | ||
if (Main.netMode == NetmodeID.MultiplayerClient || !Main.hardMode) // if its not hardmode the code will return false and wont spawn the mimic | ||
{ | ||
return false; // stops the code if the world is not in the hardmode state | ||
} | ||
int num = Chest.FindChest(x, y); | ||
if (num < 0) // checks the number of keys in the chest | ||
{ | ||
return false; // stops the code if there are no temple keys in the chest | ||
} | ||
int numberofKeys = 0; // integer value for checking amount of keys | ||
int numberOtherItems = 0; // integer value for checking if there are any other items in the chest | ||
ushort tileType = Main.tile[Main.chest[num].x, Main.chest[num].y].type; | ||
int tileStyle = (int)(Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36); | ||
if (TileID.Sets.BasicChest[tileType] && (tileStyle < 5 || tileStyle > 6)) | ||
{ | ||
for (int i = 0; i < 40; i++) | ||
{ | ||
if (Main.chest[num].item[i] != null && Main.chest[num].item[i].type > ItemID.None) // if the chest don't have any items in it, there are no temple keys in it | ||
{ | ||
if (Main.chest[num].item[i].type == ItemID.TempleKey) // What item that should be used for this npc spawning/summoning | ||
{ | ||
numberofKeys += Main.chest[num].item[i].stack; | ||
} | ||
else | ||
{ | ||
numberOtherItems++; | ||
} | ||
} | ||
} | ||
} | ||
if (numberOtherItems == 0 && numberofKeys == 1) // If there are no other items the chest & and there is 1 temple key in it | ||
{ | ||
|
||
if (TileID.Sets.BasicChest[Main.tile[x, y].type]) // checks if the tile is a chest | ||
{ | ||
if (Main.tile[x, y].frameX % 36 != 0) | ||
{ | ||
x--; | ||
} | ||
if (Main.tile[x, y].frameY % 36 != 0) | ||
{ | ||
y--; | ||
} | ||
int number = Chest.FindChest(x, y); | ||
for (int j = x; j <= x + 1; j++) | ||
{ | ||
for (int k = y; k <= y + 1; k++) | ||
{ | ||
if (TileID.Sets.BasicChest[Main.tile[j, k].type]) // Checks if the tile exist ???? | ||
{ | ||
Main.tile[j, k].active(false); | ||
} | ||
} | ||
} | ||
for (int l = 0; l < 40; l++) | ||
{ | ||
Main.chest[num].item[l] = new Item(); | ||
} | ||
Chest.DestroyChest(x, y); // removes the chest tile without dropping a chest item | ||
NetMessage.SendData(MessageID.ChestUpdates, -1, -1, null, 1, (float)x, (float)y, 0f, number, 0, 0); | ||
NetMessage.SendTileSquare(-1, x, y, 3); | ||
} | ||
int npcToSpawn = NPCID.BigMimicJungle; // What npc to spawn, in this case a Jungle Mimic | ||
int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255); // Determine where the npc will spawn | ||
Main.npc[npcIndex].whoAmI = npcIndex; | ||
NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npcIndex, 0f, 0f, 0f, 0, 0, 0); | ||
Main.npc[npcIndex].BigMimicSpawnSmoke(); // Does the mimic smoke summoning animation | ||
} | ||
return false; // stops the code | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
displayName = Neko's Tweak Mod | ||
author = Neko | ||
version = 0.1.2.2 | ||
version = 0.1.2.3 | ||
homepage = https://forums.terraria.org/index.php?threads/nekos-tweak-mod.93711/ | ||
buildIgnore = obj\*, bin\*, IconBannerArt\*, *.csproj, .git\*, .gitattributes, .gitignore, .sln, ..vs\*, LICENSE | ||
buildIgnore = obj\*, bin\*, IconBannerArt\*, *.csproj, .git\*, .gitattributes, .gitignore, .sln, ..vs\*, LICENSE, Items.vs\* , .vs\* |
Binary file not shown.