Changes

Jump to navigation Jump to search
→‎Events (SMAPI 3.0): update templates
Line 253: Line 253:  
! summary
 
! summary
 
{{/event
 
{{/event
  |name = MenuChanged
+
|group = Display
  |desc = Raised after a game menu is opened, closed, or replaced.
+
  |name = MenuChanged
 +
  |desc = Raised after a game menu is opened, closed, or replaced.
    
  |arg name 2 = <tt>e.OldMenu</tt>
 
  |arg name 2 = <tt>e.OldMenu</tt>
Line 265: Line 266:  
}}
 
}}
 
{{/event
 
{{/event
  |name = Rendering
+
|group = Display
  |desc = Raised before the game draws anything to the screen in a draw tick, as soon as the sprite batch is opened. The sprite batch may be closed and reopened multiple times after this event is called, but it's only raised once per draw tick. This event isn't useful for drawing to the screen, since the game will draw over it.
+
  |name = Rendering
 +
  |desc = Raised before the game draws anything to the screen in a draw tick, as soon as the sprite batch is opened. The sprite batch may be closed and reopened multiple times after this event is called, but it's only raised once per draw tick. This event isn't useful for drawing to the screen, since the game will draw over it.
    
Limitations:
 
Limitations:
Line 276: Line 278:  
}}
 
}}
 
{{/event
 
{{/event
  |name = Rendered
+
|group = Display
  |desc = Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen. Since the game may open/close the sprite batch multiple times in a draw tick, the sprite batch may not contain everything being drawn and some things may already be rendered to the screen. Content drawn to the sprite batch at this point will be drawn over all vanilla content (including menus, HUD, and cursor).
+
  |name = Rendered
 +
  |desc = Raised after the game draws to the sprite patch in a draw tick, just before the final sprite batch is rendered to the screen. Since the game may open/close the sprite batch multiple times in a draw tick, the sprite batch may not contain everything being drawn and some things may already be rendered to the screen. Content drawn to the sprite batch at this point will be drawn over all vanilla content (including menus, HUD, and cursor).
    
Limitations:
 
Limitations:
Line 287: Line 290:  
}}
 
}}
 
{{/event
 
{{/event
  |name = RenderingWorld
+
|group = Display
  |desc = Raised before the game world is drawn to the screen. This event isn't useful for drawing to the screen, since the game will draw over it.
+
  |name = RenderingWorld
 +
  |desc = Raised before the game world is drawn to the screen. This event isn't useful for drawing to the screen, since the game will draw over it.
    
  |arg name 1 = <tt>e.SpriteBatch</tt>
 
  |arg name 1 = <tt>e.SpriteBatch</tt>
Line 295: Line 299:  
}}
 
}}
 
{{/event
 
{{/event
  |name = RenderedWorld
+
|group = Display
  |desc = Raised after the game world is drawn to the sprite patch, before it's rendered to the screen. Content drawn to the sprite batch at this point will be drawn over the world, but under any active menu, HUD elements, or cursor.
+
  |name = RenderedWorld
 +
  |desc = Raised after the game world is drawn to the sprite patch, before it's rendered to the screen. Content drawn to the sprite batch at this point will be drawn over the world, but under any active menu, HUD elements, or cursor.
    
  |arg name 1 = <tt>e.SpriteBatch</tt>
 
  |arg name 1 = <tt>e.SpriteBatch</tt>
Line 303: Line 308:  
}}
 
}}
 
{{/event
 
{{/event
  |name = RenderingActiveMenu
+
|group = Display
  |desc = When a menu is open (<tt>Game1.activeClickableMenu != null</tt>), raised before that menu is drawn to the screen. This includes the game's internal menus like the title screen. Content drawn to the sprite batch at this point will appear under the menu.
+
  |name = RenderingActiveMenu
 +
  |desc = When a menu is open (<tt>Game1.activeClickableMenu != null</tt>), raised before that menu is drawn to the screen. This includes the game's internal menus like the title screen. Content drawn to the sprite batch at this point will appear under the menu.
    
  |arg name 1 = <tt>e.SpriteBatch</tt>
 
  |arg name 1 = <tt>e.SpriteBatch</tt>
Line 311: Line 317:  
}}
 
}}
 
{{/event
 
{{/event
  |name = RenderedActiveMenu
+
|group = Display
  |desc = When a menu is open (<tt>Game1.activeClickableMenu != null</tt>), raised after that menu is drawn to the sprite batch but before it's rendered to the screen. Content drawn to the sprite batch at this point will appear over the menu and menu cursor.
+
  |name = RenderedActiveMenu
 +
  |desc = When a menu is open (<tt>Game1.activeClickableMenu != null</tt>), raised after that menu is drawn to the sprite batch but before it's rendered to the screen. Content drawn to the sprite batch at this point will appear over the menu and menu cursor.
    
  |arg name 1 = <tt>e.SpriteBatch</tt>
 
  |arg name 1 = <tt>e.SpriteBatch</tt>
Line 319: Line 326:  
}}
 
}}
 
{{/event
 
{{/event
  |name = RenderingHud
+
|group = Display
  |desc = Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear under the HUD.
+
  |name = RenderingHud
 +
  |desc = Raised before drawing the HUD (item toolbar, clock, etc) to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear under the HUD.
    
  |arg name 1 = <tt>e.SpriteBatch</tt>
 
  |arg name 1 = <tt>e.SpriteBatch</tt>
Line 327: Line 335:  
}}
 
}}
 
{{/event
 
{{/event
  |name = RenderedHud
+
|group = Display
  |desc = Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear over the HUD.
+
  |name = RenderedHud
 +
  |desc = Raised after drawing the HUD (item toolbar, clock, etc) to the sprite batch, but before it's rendered to the screen. The vanilla HUD may be hidden at this point (e.g. because a menu is open). Content drawn to the sprite batch at this point will appear over the HUD.
    
  |arg name 1 = <tt>e.SpriteBatch</tt>
 
  |arg name 1 = <tt>e.SpriteBatch</tt>
Line 335: Line 344:  
}}
 
}}
 
{{/event
 
{{/event
  |name = WindowResized
+
|group = Display
  |desc = Raised after the game window is resized.
+
  |name = WindowResized
 +
  |desc = Raised after the game window is resized.
    
  |arg name 1 = <tt>e.OldSize</tt>
 
  |arg name 1 = <tt>e.OldSize</tt>
Line 356: Line 366:  
! summary
 
! summary
 
{{/event
 
{{/event
  |name = GameLaunched
+
|group = GameLoop
  |desc = Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.
+
  |name = GameLaunched
 +
  |desc = Raised after the game is launched, right before the first update tick. This happens once per game session (unrelated to loading saves). All mods are loaded and initialised at this point, so this is a good time to set up mod integrations.
 
}}
 
}}
 
{{/event
 
{{/event
  |name = UpdateTicking, UpdateTicked
+
|group = GameLoop
  |desc = Raised before/after the game state is updated (≈60 times per second).
+
  |name = UpdateTicking, UpdateTicked
 +
  |desc = Raised before/after the game state is updated (≈60 times per second).
    
  |arg name 1 = <tt>e.Ticks</tt>
 
  |arg name 1 = <tt>e.Ticks</tt>
Line 376: Line 388:  
}}
 
}}
 
{{/event
 
{{/event
  |name = SaveCreating, SaveCreated
+
|group = GameLoop
  |desc = Raised before/after the game creates the save file (after the new-game intro). The save won't be written until all mods have finished handling this event. This is a somewhat specialised event, since the world isn't fully initialised at this point; in most cases you should use [[#DayStarted|<tt>DayStarted</tt>]], [[#Saving|<tt>Saving</tt>]], [[#Saved|<tt>Saved</tt>]] instead.
+
  |name = SaveCreating, SaveCreated
 +
  |desc = Raised before/after the game creates the save file (after the new-game intro). The save won't be written until all mods have finished handling this event. This is a somewhat specialised event, since the world isn't fully initialised at this point; in most cases you should use [[#DayStarted|<tt>DayStarted</tt>]], [[#Saving|<tt>Saving</tt>]], [[#Saved|<tt>Saved</tt>]] instead.
 
}}
 
}}
 
{{/event
 
{{/event
 +
|group = GameLoop
 
  |name = Saving, Saved
 
  |name = Saving, Saved
 
  |desc = Raised before/after the game writes data to save file (except [[#SaveCreating|the initial save creation]]). The save won't be written until all mods have finished handling this event.
 
  |desc = Raised before/after the game writes data to save file (except [[#SaveCreating|the initial save creation]]). The save won't be written until all mods have finished handling this event.
 
}}
 
}}
 
{{/event
 
{{/event
  |name = SaveLoaded
+
|group = GameLoop
  |desc = Raised before/after the game reads data from a save file and initialises the world. This event isn't raised after saving; if you want to do something at the start of each day, see [[#DayStarted|<tt>DayStarted</tt>]] instead.
+
  |name = SaveLoaded
 +
  |desc = Raised before/after the game reads data from a save file and initialises the world. This event isn't raised after saving; if you want to do something at the start of each day, see [[#DayStarted|<tt>DayStarted</tt>]] instead.
 
}}
 
}}
 
{{/event
 
{{/event
  |name = DayStarted
+
|group = GameLoop
  |desc = Raised after a new in-game day starts. Everything has already been initialised at this point. (To run code before the game sets up the day, see [[#DayEnding|<tt>DayEnding</tt>]] instead.)
+
  |name = DayStarted
 +
  |desc = Raised after a new in-game day starts. Everything has already been initialised at this point. (To run code before the game sets up the day, see [[#DayEnding|<tt>DayEnding</tt>]] instead.)
 
}}
 
}}
 
{{/event
 
{{/event
  |name = DayEnding
+
|group = GameLoop
  |desc = Raised before the game ends the current day. This happens before it starts setting up the next day and before [[#Saving|<tt>Saving</tt>]].
+
  |name = DayEnding
 +
  |desc = Raised before the game ends the current day. This happens before it starts setting up the next day and before [[#Saving|<tt>Saving</tt>]].
 
}}
 
}}
 
{{/event
 
{{/event
  |name = ReturnedToTitle
+
|group = GameLoop
  |desc = Raised after the game returns to the title screen.
+
  |name = ReturnedToTitle
 +
  |desc = Raised after the game returns to the title screen.
 
}}
 
}}
 
|}
 
|}
Line 409: Line 427:  
! summary
 
! summary
 
{{/event
 
{{/event
  |name = ButtonPressed, ButtonReleased
+
|group = Input
  |desc = Raised after the player pressed/released a keyboard, mouse, or controller button. This includes mouse clicks.
+
  |name = ButtonPressed, ButtonReleased
 +
  |desc = Raised after the player pressed/released a keyboard, mouse, or controller button. This includes mouse clicks.
    
  |arg name 1 = <tt>e.Button</tt>
 
  |arg name 1 = <tt>e.Button</tt>
Line 431: Line 450:  
}}
 
}}
 
{{/event
 
{{/event
  |name = CursorMoved
+
|group = Input
  |desc = Raised after the player moves the in-game cursor.
+
  |name = CursorMoved
 +
  |desc = Raised after the player moves the in-game cursor.
    
  |arg name 1 = <tt>e.OldPosition</tt>
 
  |arg name 1 = <tt>e.OldPosition</tt>
Line 443: Line 463:  
}}
 
}}
 
{{/event
 
{{/event
  |name = MouseWheelScrolled
+
|group = Input
  |desc = Raised after the player scrolls the mouse wheel.
+
  |name = MouseWheelScrolled
 +
  |desc = Raised after the player scrolls the mouse wheel.
    
  |arg name 1 = <tt>e.Position</tt>
 
  |arg name 1 = <tt>e.Position</tt>
Line 470: Line 491:  
! summary
 
! summary
 
{{/event
 
{{/event
  |name = InventoryChanged
+
|group = Player
  |desc = Raised after items are added or removed from the player inventory.
+
  |name = InventoryChanged
 +
  |desc = Raised after items are added or removed from the player inventory.
    
  |arg name 1 = <tt>e.Player</tt>
 
  |arg name 1 = <tt>e.Player</tt>
Line 490: Line 512:  
}}
 
}}
 
{{/event
 
{{/event
  |name = LevelChanged
+
|group = Player
  |desc = Raised after a player's skill level changes. When the player levels up normally, this is raised immediately (not when the game notifies the player after they go to bed).
+
  |name = LevelChanged
 +
  |desc = Raised after a player's skill level changes. When the player levels up normally, this is raised immediately (not when the game notifies the player after they go to bed).
    
  |arg name 1 = <tt>e.Player</tt>
 
  |arg name 1 = <tt>e.Player</tt>
Line 510: Line 533:  
}}
 
}}
 
{{/event
 
{{/event
  |name = Warped
+
|group = Player
  |desc = Raised after the current player moves to a new location.
+
  |name = Warped
 +
  |desc = Raised after the current player moves to a new location.
    
  |arg name 1 = <tt>e.Player</tt>
 
  |arg name 1 = <tt>e.Player</tt>
Line 535: Line 559:  
! summary
 
! summary
 
{{/event
 
{{/event
  |name = LocationListChanged
+
|group = World
  |desc = Raised after a game location is added or removed (including building interiors).
+
  |name = LocationListChanged
 +
  |desc = Raised after a game location is added or removed (including building interiors).
    
  |arg name 1 = <tt>e.Added</tt>
 
  |arg name 1 = <tt>e.Added</tt>
Line 548: Line 573:     
{{/event
 
{{/event
  |name = BuildingListChanged
+
|group = World
  |desc = Raised after buildings are added/removed in any location.
+
  |name = BuildingListChanged
 +
  |desc = Raised after buildings are added/removed in any location.
    
  |arg name 1 = <tt>e.Location</tt>
 
  |arg name 1 = <tt>e.Location</tt>
Line 564: Line 590:  
}}
 
}}
 
{{/event
 
{{/event
  |name = DebrisListChanged
+
|group = World
  |desc = Raised after debris is added/removed in any location (including dropped or spawned floating items).
+
  |name = DebrisListChanged
 +
  |desc = Raised after debris is added/removed in any location (including dropped or spawned floating items).
    
  |arg name 1 = <tt>e.Location</tt>
 
  |arg name 1 = <tt>e.Location</tt>
Line 580: Line 607:  
}}
 
}}
 
{{/event
 
{{/event
  |name = LargeTerrainFeatureListChanged
+
|group = World
  |desc = Raised after large terrain features (like bushes) are added/removed in any location.
+
  |name = LargeTerrainFeatureListChanged
 +
  |desc = Raised after large terrain features (like bushes) are added/removed in any location.
    
  |arg name 1 = <tt>e.Location</tt>
 
  |arg name 1 = <tt>e.Location</tt>
Line 596: Line 624:  
}}
 
}}
 
{{/event
 
{{/event
  |name = NpcListChanged
+
|group = World
  |desc = Raised after NPCs are added/removed in any location (including villagers, horses, Junimos, monsters, and pets).
+
  |name = NpcListChanged
 +
  |desc = Raised after NPCs are added/removed in any location (including villagers, horses, Junimos, monsters, and pets).
    
  |arg name 1 = <tt>e.Location</tt>
 
  |arg name 1 = <tt>e.Location</tt>
Line 612: Line 641:  
}}
 
}}
 
{{/event
 
{{/event
  |name = ObjectListChanged
+
|group = World
  |desc = Raised after objects are added/removed in any location (including machines, furniture, fences, etc). For floating items, see <tt>DebrisListChanged</tt>.
+
  |name = ObjectListChanged
 +
  |desc = Raised after objects are added/removed in any location (including machines, furniture, fences, etc). For floating items, see <tt>DebrisListChanged</tt>.
    
  |arg name 1 = <tt>e.Location</tt>
 
  |arg name 1 = <tt>e.Location</tt>
Line 628: Line 658:  
}}
 
}}
 
{{/event
 
{{/event
  |name = TerrainFeatureListChanged
+
|group = World
  |desc = Raised after terrain features are added/removed in any location (including trees, hoed dirt, and flooring). For bushes, see <tt>LargeTerrainFeatureListChanged</tt>.
+
  |name = TerrainFeatureListChanged
 +
  |desc = Raised after terrain features are added/removed in any location (including trees, hoed dirt, and flooring). For bushes, see <tt>LargeTerrainFeatureListChanged</tt>.
    
  |arg name 1 = <tt>e.Location</tt>
 
  |arg name 1 = <tt>e.Location</tt>
Line 653: Line 684:  
! summary
 
! summary
 
{{/event
 
{{/event
  |name = UnvalidatedUpdateTicking, UnvalidatedUpdateTicked
+
|group = Specialised
  |desc = Raised before/after the game updates its state (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. '''Do not use this event unless you're fully aware of the context in which your code will be run. Using this event will trigger a warning in the SMAPI console.'''
+
  |name = UnvalidatedUpdateTicking, UnvalidatedUpdateTicked
 +
  |desc = Raised before/after the game updates its state (≈60 times per second), regardless of normal SMAPI validation. This event is not thread-safe and may be invoked while game logic is running asynchronously. Changes to game state in this method may crash the game or corrupt an in-progress save. '''Do not use this event unless you're fully aware of the context in which your code will be run. Using this event will trigger a warning in the SMAPI console.'''
     
translators
8,439

edits

Navigation menu