1using Microsoft.Xna.Framework;
3using System.Collections.Generic;
4using Terraria.GameContent;
16 internal static readonly IDictionary<string, int> gores =
new Dictionary<string, int>();
17 internal static readonly IDictionary<int, ModGore> modGores =
new Dictionary<int, ModGore>();
22 internal static int ReserveGoreID() {
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) {
54 Main.goreTexture[gores[texture]] = ModContent.GetTexture(texture);
58 internal static void Unload() {
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) {
This class allows you to customize the behavior of a custom gore. Create a new instance of this and p...
static int GetGoreSlot(string texture)
Gets the type of the custom gore corresponding to the given texture. Returns 0 if the texture does no...
int updateType
Allows you to copy the Update behavior of a different type of gore. This defaults to 0,...
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...
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...
virtual void OnSpawn(Gore gore)
Allows you to modify a gore's fields when it is created.
virtual bool DrawBehind(Gore gore)
Allows you to determine whether or not this gore will draw behind tiles, etc. Returns false by defaul...