noitapatcher

class noitapatcher.NoitaPatcher
static InstallShootProjectileFiredCallbacks()

Enable OnProjectileFired and OnProjectileFiredPost callbacks.

Return type:

nil

static InstallDamageDetailsPatch()

Enables GetDamageDetails in newly created Lua states.

Return type:

nil

static SetProjectileSpreadRNG(rng_value)

Sets Noita’s internal RNG state to the specified value.

This RNG state is used for many things including setting a fired projectile’s direction based on random spread.

Parameters:

rng_value (integer) – New RNG state value

static RegisterPlayerEntityId(entity_id)

Disable the red flash upon taking damage for all entities with a PlatformShooterPlayerComponent except for the one specified by entity_id.

You can restore the original behaviour by passing in -1 for the entity_id.

Parameters:

entity_id (integer) – ID of the only entity for which to do the damage flash.

static SetActiveHeldEntity(entity_id, item_id, unknown, make_noise)

Change the item that the entity is holding.

Parameters:
  • entity_id (integer) – id of the entity for which you want to change what they are holding.

  • item_id (integer) – id of the entity that should be held. For the best effect it should be an item in the inventory_quick child of the entity specified by entity_id.

  • unknown (boolean) – Not sure what this does. Let me know if you find out!

  • make_noise (boolean) – Whether or not switching to this item should make a noise.

static SetPlayerEntity(entity_id, player_nr)

Changes the entity that the game considers to be the player.

This determines what entity is followed by the camera and whose death ends the game. A bunch more stuff is probably tied to this.

Parameters:
  • entity_id (integer) – The entity to make the game think of as the player.

  • player_nr (integer) – ? Player number to change. Defaults to 0

static GetPlayerEntity(player_nr)

Get the entity that the game considers to be the player.

Parameters:

player_nr (integer) – ? Player number to get the entity of. Defaults to 0

static EnableGameSimulatePausing(enabled)

Enables or disables game simulate pausing when opening escape or wand menu.

Parameters:

enabled (boolean) – Whether to enable or disable pausing.

static EnableInventoryGuiUpdate(enabled)

Disable InventoryGuiComponent updates without disabling the component.

Disabling updates for this component makes clicking on an empty wand slot work after using EnableGameSimulatePausing(false) and entering the wand pickup menu.

Parameters:

enabled (boolean) – Whether to enable or disable Inventory GUI updates.

static EnablePlayerItemPickUpper(enabled)

Enable/disable ItemPickUpperComponent updates for the entity registerd using RegisterPlayerEntityId

Disabling updates for this component prevents double wand cards from appearing after using EnableGameSimulatePausing(false) and entering the wand pickup menu.

Parameters:

enabled (boolean) – Whether to enable or disable ItemPickUpper updates.

static UseItem(responsible_entity_id, item_entity_id, ignore_reload, charge, started_using_this_frame, pos_x, pos_y, target_x, target_y)

Send a ‘use item’ message causing the item to get activated by the entity’s ability component.

Parameters:
  • responsible_entity_id (integer) – Entity that should be seen as responsible for the item’s use.

  • item_entity_id (integer) – Wand or other item entity.

  • ignore_reload (boolean)

  • charge (boolean)

  • started_using_this_frame (boolean)

  • pos_x (number)

  • pos_y (number)

  • target_x (number)

  • target_y (number)

static SilenceLogs(logstr)

Patch out logging for a certain string literal.

Parameters:

logstr (str) – The string to look for in the exe, it should end with a newline character in most cases.

Returns:

patch_successful

Return type:

boolean

static ForceLoadPixelScene(materials_filename, colors_filename, x, y, background_file, skip_biome_checks, skip_edge_textures, color_to_material_table, background_z_index)

Like Noita’s LoadPixelScene, but doesn’t care if the scene has been loaded before.

Parameters:
  • materials_filename (str)

  • colors_filename (str)

  • x (number)

  • y (number)

  • background_file (str)

  • skip_biome_checks (boolean) – Defaults to false

  • skip_edge_textures (boolean) – Defaults to false

  • color_to_material_table (table) – Defaults to {}

  • background_z_index (integer) – Defaults to 50

static EnableExtendedLogging(enable)

Enable source location logging

Parameters:

enable (boolean) – enable or disable

static EnableLogFiltering(enable)

Enable the FilterLog callback

Parameters:

enable (boolean) – enable or disable

static ComponentUpdatesSetEnabled(system_name, change_to)

Disable system updates

Parameters:
  • system_name (str) – Name of the system to disable, for instance BlackHoleSystem

  • change_to (boolean) – enable (true) or disable (false)

Returns:

change_succeeded

Return type:

boolean

static SerializeEntity(entity_id)

Serialize an entity

Parameters:

entity_id (integer)

Returns:

serialized_data

Return type:

str

static DeserializeEntity(entity_id, serialized_data, x, y)

Deserialize an entity. If x and y are provided then the entity’s position is changed to that instead of using the position info in the serialized data.

Parameters:
  • entity_id (integer) – Entity to deserialize into, most of the time you want this to be an “empty” entity.

  • serialized_data (str) – The serialized data

  • x (number) – ? Position to force the entity to if provided

  • y (number) – ? Position to force the entity to if provided

Returns:

? entity_id The entity_id passed into the function if deserialization was successful.

Return type:

integer

static PhysBodySetTransform(component_id, x, y, r, vx, vy, av)

Set box2d parameters of a PhysicsBody(2)Component

Parameters:
  • component_id (integer) – The PhysicsBody(2)Component

  • x (number) – box2d x coordinate

  • y (number) – box2d y coordinate

  • r (number) – box2d rotation

  • vx (number) – box2d x velocity

  • vy (number) – box2d y velocity

  • av (number) – box2d angular velocity

static PhysBodyGetTransform(component_id)

Get the box2d parameters of a PhysicsBody(2)Component

Parameters:

component_id (integer) – The PhysicsBody(2)Component

Returns:

box2d x coordinate

Return type:

number

Returns:

box2d y coordinate

Return type:

number

Returns:

box2d rotation

Return type:

number

Returns:

box2d x velocity

Return type:

number

Returns:

box2d y velocity

Return type:

number

Returns:

box2d angular velocity

Return type:

number

static SetGameModeDeterministic(deterministic)

Mark the current game mode as a daily. Disables spell unlocks and if called during mod init makes all spells available for the run.

Parameters:

deterministic (boolean)

static SetPauseState(value)

Set the current pause state bitfield.

0, 1, 4 and >=32 are safe values to use. 0 means unpaused, 4 is the escape menu pause, the other safe values don’t have any GUI.

Parameters:

value (integer) – new pause state value

Returns:

previous pause state value

Return type:

integer

static GetPauseState()

Set the current pause state bitfield value.

Returns:

current pause state value

Return type:

integer

static SetInventoryCursorEnabled(enable)

Enable or disable inventory cursor interactions.

Parameters:

enable (boolean)

static CrossCallAdd(name, f)

Create or replace a cross call function

Parameters:
  • name (str)

  • f (function) – (…: (boolean|number|string|nil|lightuserdata)): boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata,boolean|number|string|nil|lightuserdata

class noitapatcher.DamageDetails

Get more info about damage inside a LuaComponent damage callback.

You must have previously called np.InstallDamageDetailsPatch for this to work.