1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
4 using System.Collections.Generic;
13 public abstract partial class Mod
21 UpdateMusic(ref music);
28 [Obsolete(
"This UpdateMusic method now obsolete, use the UpdateMusic with the MusicPriority parameter.")]
61 public virtual bool HijackSendData(
int whoAmI,
int msgType,
int remoteClient,
int ignoreClient, NetworkText text,
int number,
float number2,
float number3,
float number4,
int number5,
int number6,
int number7) {
74 public virtual void UpdateUI(GameTime gameTime) {
219 internal static class ModHooks
222 internal static void UpdateMusic(ref
int music, ref
MusicPriority priority) {
226 mod.UpdateMusic(ref modMusic, ref modPriority);
227 if (modMusic >= 0 && modPriority >= priority) {
229 priority = modPriority;
235 internal static void HotKeyPressed() {
236 foreach (var modHotkey
in HotKeyLoader.HotKeys) {
237 if (PlayerInput.Triggers.Current.KeyStatus[modHotkey.uniqueName]) {
238 modHotkey.mod.HotKeyPressed(modHotkey.name);
243 internal static void ModifyTransformMatrix(ref SpriteViewMatrix Transform) {
245 mod.ModifyTransformMatrix(ref Transform);
249 internal static void ModifySunLight(ref Color tileColor, ref Color backgroundColor) {
250 if (Main.gameMenu)
return;
252 mod.ModifySunLightColor(ref tileColor, ref backgroundColor);
256 internal static void ModifyLightingBrightness(ref
float negLight, ref
float negLight2) {
259 mod.ModifyLightingBrightness(ref scale);
261 if (Lighting.NotRetro) {
266 negLight -= (scale - 1f) / 2.307692307692308f;
267 negLight2 -= (scale - 1f) / 0.75f;
269 negLight = Math.Max(negLight, 0.001f);
270 negLight2 = Math.Max(negLight2, 0.001f);
273 internal static void PostDrawFullscreenMap(ref
string mouseText) {
275 mod.PostDrawFullscreenMap(ref mouseText);
279 internal static void UpdateUI(GameTime gameTime) {
280 if (Main.gameMenu)
return;
282 mod.UpdateUI(gameTime);
286 public static void PreUpdateEntities() {
288 mod.PreUpdateEntities();
292 public static void MidUpdatePlayerNPC() {
294 mod.MidUpdatePlayerNPC();
298 public static void MidUpdateNPCGore() {
300 mod.MidUpdateNPCGore();
304 public static void MidUpdateGoreProjectile() {
306 mod.MidUpdateGoreProjectile();
310 public static void MidUpdateProjectileItem() {
312 mod.MidUpdateProjectileItem();
316 public static void MidUpdateItemDust() {
318 mod.MidUpdateItemDust();
322 public static void MidUpdateDustTime() {
324 mod.MidUpdateDustTime();
328 public static void MidUpdateTimeWorld() {
330 mod.MidUpdateTimeWorld();
334 public static void MidUpdateInvasionNet() {
336 mod.MidUpdateInvasionNet();
340 public static void PostUpdateEverything() {
342 mod.PostUpdateEverything();
346 internal static void ModifyInterfaceLayers(List<GameInterfaceLayer> layers) {
347 foreach (GameInterfaceLayer layer
in layers) {
351 mod.ModifyInterfaceLayers(layers);
355 internal static void PostDrawInterface(SpriteBatch spriteBatch) {
357 mod.PostDrawInterface(spriteBatch);
361 internal static void PostUpdateInput() {
363 mod.PostUpdateInput();
367 internal static void PreSaveAndQuit() {
369 mod.PreSaveAndQuit();
virtual void MidUpdateNPCGore()
Called after NPCs got updated, but before any Gores get updated.
MusicPriority
This enum dictates from low to high which music selections take priority. Setting appropriate MusicPr...
virtual void MidUpdateProjectileItem()
Gets called immediately after all Projectiles are updated, but before any Items get updated...
virtual void UpdateMusic(ref int music)
A legacy hook that you should no longer use. Use the version with two parameters instead.
virtual void UpdateMusic(ref int music, ref MusicPriority priority)
Allows you to determine what music should currently play.
This serves as the central class which loads mods. It contains many static fields and methods related...
virtual void PreUpdateEntities()
Use this if you want to do something before anything in the World gets updated. Called after UI updat...
virtual bool HijackSendData(int whoAmI, int msgType, int remoteClient, int ignoreClient, NetworkText text, int number, float number2, float number3, float number4, int number5, int number6, int number7)
Hijacks the send data method. Only use if you absolutely know what you are doing. If any hooks return...
virtual bool HijackGetData(ref byte messageType, ref BinaryReader reader, int playerNumber)
Allows you to modify net message / packet information that is received before the game can act on it...
virtual void HotKeyPressed(string name)
Called when a hotkey is pressed. Check against the name to verify particular hotkey that was pressed...
virtual void HandlePacket(BinaryReader reader, int whoAmI)
Called whenever a net message / packet is received from a client (if this is a server) or the server ...
virtual void MidUpdateDustTime()
Called after Dust got updated, but before Time (day/night, events, etc.) gets updated.
virtual void PostDrawFullscreenMap(ref string mouseText)
Called while the fullscreen map is active. Allows custom drawing to the map.
virtual void MidUpdateItemDust()
Called after Items got updated, but before any Dust gets updated.
virtual void MidUpdatePlayerNPC()
Called after Players got updated, but before any NPCs get updated.
virtual void ModifyInterfaceLayers(List< GameInterfaceLayer > layers)
Allows you to modify the elements of the in-game interface that get drawn. GameInterfaceLayer can be ...
virtual void MidUpdateGoreProjectile()
Called after Gores got updated, but before any Projectiles get updated.
virtual void PostUpdateEverything()
Called after the Network got updated, this is the last hook that happens in an update.
virtual void ModifyTransformMatrix(ref SpriteViewMatrix Transform)
Allows you to set the transformation of the screen that is drawn. (Translations, rotations, scales, etc.)
virtual void MidUpdateTimeWorld()
Called after Time got updated, but before the World gets updated.
virtual void ModifyLightingBrightness(ref float scale)
Allows you to modify overall brightness of lights. Can be used to create effects similiar to what nig...
Mod is an abstract class that you will override. It serves as a central place from which the mod's co...
virtual void MidUpdateInvasionNet()
Called after Invasions got updated. The only thing that is updated after this is the Network...
virtual void ModifySunLightColor(ref Color tileColor, ref Color backgroundColor)
Allows you to modify color of light the sun emits.
virtual void PreSaveAndQuit()
Called in SP or Client when the Save and Quit button is pressed. One use for this hook is clearing ou...
virtual void PostDrawInterface(SpriteBatch spriteBatch)
Called after interface is drawn but right before mouse and mouse hover text is drawn. Allows for drawing interface.
virtual void UpdateUI(GameTime gameTime)
Ran every update and suitable for calling Update for UserInterface classes
virtual void PostUpdateInput()
Called after the input keys are polled. Allows for modifying things like scroll wheel if your custom ...