1 using Microsoft.Xna.Framework;
3 using System.Collections.Generic;
14 private static int nextGore = GoreID.Count;
15 public static int GoreCount => nextGore;
16 internal static readonly IDictionary<string, int> gores =
new Dictionary<string, int>();
17 internal static readonly IDictionary<int, ModGore> modGores =
new Dictionary<int, ModGore>();
20 public int updateType = -1;
22 internal static int ReserveGoreID() {
23 int reserveID = nextGore;
32 if (gores.ContainsKey(texture)) {
33 return gores[texture];
41 internal static void ResizeAndFillArrays() {
42 Array.Resize(ref Main.goreLoaded, nextGore);
43 Array.Resize(ref Main.goreTexture, nextGore);
44 Array.Resize(ref ChildSafety.SafeGore, nextGore);
45 Array.Resize(ref GoreID.Sets.SpecialAI, nextGore);
46 Array.Resize(ref GoreID.Sets.DisappearSpeed, nextGore);
47 Array.Resize(ref GoreID.Sets.DisappearSpeedAlpha, nextGore);
48 for (
int k = GoreID.Count; k < nextGore; k++) {
49 Main.goreLoaded[k] =
true;
50 GoreID.Sets.DisappearSpeed[k] = 1;
51 GoreID.Sets.DisappearSpeedAlpha[k] = 1;
53 foreach (
string texture
in gores.Keys) {
58 internal static void Unload() {
61 nextGore = GoreID.Count;
66 internal static void SetupGore(Gore gore) {
67 if (modGores.ContainsKey(gore.type)) {
68 gore.modGore = modGores[gore.type];
69 gore.modGore.OnSpawn(gore);
76 internal static void SetupUpdateType(Gore gore) {
77 if (gore.modGore != null && gore.modGore.updateType > 0) {
78 gore.realType = gore.type;
79 gore.type = gore.modGore.updateType;
83 internal static void TakeDownUpdateType(Gore gore) {
84 if (gore.realType > 0) {
85 gore.type = gore.realType;
91 internal static bool DrawBackGore(Gore gore) {
92 if (gore.modGore != null) {
93 return gore.modGore.DrawBehind(gore);
95 return ((gore.type >= 706 && gore.type <= 717) || gore.type == 943) && (gore.frame < 7 || gore.frame > 9);
120 public virtual Color?
GetAlpha(Gore gore, Color lightColor) {
static Texture2D GetTexture(string name)
Gets the texture with the specified name. The name is in the format of "ModFolder/OtherFolders/FileNa...
virtual bool DrawBehind(Gore gore)
Allows you to determine whether or not this gore will draw behind tiles, etc. Returns false by defaul...
This class allows you to customize the behavior of a custom gore. Create a new instance of this and p...
Manages content added by mods. Liasons between mod content and Terraria's arrays and oversees the Loa...
virtual void OnSpawn(Gore gore)
Allows you to modify a gore's fields when it is created.
virtual Color GetAlpha(Gore gore, Color lightColor)
Allows you to override the color this gore will draw in. Return null to draw it in the normal light c...
static int GetGoreSlot(string texture)
Gets the type of the custom gore corresponding to the given texture. Returns 0 if the texture does no...
virtual bool Update(Gore gore)
Allows you to customize how you want this type of gore to behave. Return true to allow for vanilla go...