mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-22 21:17:33 +00:00
David Vogel
98dfb5fbb0
- Remove unused util functions - Put util stuff into its own namespace - Move all initialization stuff into root init.lua - Move progressBarString function into ui.lua - Fix ffi.load error message - Fix DebugAPI.BiomeMapGetFilename - Move JSON lib into Noita API wrapper - Move Vec2 lib into Noita API wrapper - Move compatibility stuff into Noita API wrapper - Emulate package tables if in restricted API mode - Emulate require if in restricted API mode - Use require instead of dofile_once everywhere - Fix WrapID method to accept nil - Add EmmyLua annotations for the default Noita API - Add README.md to Noita API wrapper
31 lines
1.1 KiB
Lua
31 lines
1.1 KiB
Lua
-- Copyright (c) 2022 David Vogel
|
|
--
|
|
-- This software is released under the MIT License.
|
|
-- https://opensource.org/licenses/MIT
|
|
|
|
-- Emulate and override some functions and tables to make everything conform more to standard lua.
|
|
-- This will make `require` work, even in sandboxes with restricted Noita API.
|
|
local modFolder = "noita-mapcap"
|
|
dofile("mods/" .. modFolder .. "/files/libraries/noita-api/compatibility.lua")(modFolder)
|
|
|
|
local EntityAPI = require("libraries.noita-api.entity")
|
|
|
|
local oldPerkSpawn = perk_spawn
|
|
|
|
---Spawns a perk.
|
|
---@param x number
|
|
---@param y number
|
|
---@param perkID integer
|
|
---@param dontRemoveOtherPerks boolean
|
|
---@return NoitaEntity|nil
|
|
function perk_spawn(x, y, perkID, dontRemoveOtherPerks)
|
|
local entity = EntityAPI.WrapID(oldPerkSpawn(x, y, perkID, dontRemoveOtherPerks))
|
|
if entity == nil then return end
|
|
|
|
-- Remove the SpriteOffsetAnimatorComponent components from the entity.
|
|
local components = entity:GetComponents("SpriteOffsetAnimatorComponent")
|
|
for _, component in ipairs(components) do
|
|
entity:RemoveComponent(component)
|
|
end
|
|
end
|