diff --git a/data/entities/base_custom_card.xml b/data/entities/base_custom_card.xml
new file mode 100644
index 0000000..bf2cc23
--- /dev/null
+++ b/data/entities/base_custom_card.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/data/entities/misc/custom_cards/action.xml b/data/entities/misc/custom_cards/action.xml
new file mode 100644
index 0000000..fd5a3d2
--- /dev/null
+++ b/data/entities/misc/custom_cards/action.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/data/entities/misc/custom_cards/energy_shield.xml b/data/entities/misc/custom_cards/energy_shield.xml
new file mode 100644
index 0000000..887096d
--- /dev/null
+++ b/data/entities/misc/custom_cards/energy_shield.xml
@@ -0,0 +1,153 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/files/capture.lua b/files/capture.lua
index a9e5c44..5d11805 100644
--- a/files/capture.lua
+++ b/files/capture.lua
@@ -45,7 +45,7 @@ local componentTypeNamesToDisable = {
"DamageModelComponent",
"PhysicsBodyCollisionDamageComponent",
"ExplodeOnDamageComponent",
- "SpriteOffsetAnimatorComponent",
+ --"SpriteOffsetAnimatorComponent",
--"PhysicsBody2Component", -- Disabling will hide barrels and similar stuff, also triggers an assertion.
--"PhysicsBodyComponent",
--"VelocityComponent", -- Disabling this component may cause a "...\component_updators\advancedfishai_system.cpp at line 107" exception.
@@ -125,13 +125,13 @@ local function captureEntities(entityFile, x, y, radius)
end
-- Disable the hover animation of cards. Disabling the "SpriteOffsetAnimatorComponent" does not help.
- local components = rootEntity:GetComponents("SpriteOffsetAnimatorComponent")
- for _, component in ipairs(components) do
- component:SetValue("x_speed", 0)
- component:SetValue("y_speed", 0)
- component:SetValue("x_amount", 0)
- component:SetValue("y_amount", 0)
- end
+ --local components = rootEntity:GetComponents("SpriteOffsetAnimatorComponent")
+ --for _, component in ipairs(components) do
+ -- component:SetValue("x_speed", 0)
+ -- component:SetValue("y_speed", 0)
+ -- component:SetValue("x_amount", 0)
+ -- component:SetValue("y_amount", 0)
+ --end
end
end
diff --git a/files/noita-api.lua b/files/noita-api.lua
index 32ae5a8..6ceb66b 100644
--- a/files/noita-api.lua
+++ b/files/noita-api.lua
@@ -23,6 +23,14 @@ local EntityAPI = {}
local NoitaEntity = {}
NoitaEntity.__index = NoitaEntity
+---WrapID wraps the given entity ID and returns a Noita entity object.
+---@param id number
+---@return NoitaEntity|nil
+function EntityAPI.WrapID(id)
+ if id == nil or type(id) ~= "number" then return nil end
+ return setmetatable({ ID = id }, NoitaEntity)
+end
+
local ComponentAPI = {}
---@class NoitaComponent
@@ -30,6 +38,14 @@ local ComponentAPI = {}
local NoitaComponent = {}
NoitaComponent.__index = NoitaComponent
+---WrapID wraps the given component ID and returns a Noita component object.
+---@param id number
+---@return NoitaComponent|nil
+function ComponentAPI.WrapID(id)
+ if id == nil or type(id) ~= "number" then return nil end
+ return setmetatable({ ID = id }, NoitaComponent)
+end
+
-------------------------
-- JSON Implementation --
-------------------------
diff --git a/files/overrides/perks/perk.lua b/files/overrides/perks/perk.lua
new file mode 100644
index 0000000..c020d24
--- /dev/null
+++ b/files/overrides/perks/perk.lua
@@ -0,0 +1,26 @@
+-- Copyright (c) 2022 David Vogel
+--
+-- This software is released under the MIT License.
+-- https://opensource.org/licenses/MIT
+
+---@type NoitaAPI
+local noitaAPI = dofile_once("mods/noita-mapcap/files/noita-api.lua")
+
+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 = noitaAPI.Entity.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
\ No newline at end of file
diff --git a/init.lua b/init.lua
index b1947f6..b97b4dd 100644
--- a/init.lua
+++ b/init.lua
@@ -1,3 +1,8 @@
+-- Copyright (c) 2022 David Vogel
+--
+-- This software is released under the MIT License.
+-- https://opensource.org/licenses/MIT
+
dofile("mods/noita-mapcap/files/init.lua")
function OnPlayerSpawned(player_entity)
@@ -11,3 +16,6 @@ function OnWorldPostUpdate() -- this is called every time the game has finished
end
ModMagicNumbersFileAdd("mods/noita-mapcap/files/magic_numbers.xml") -- override some game constants
+
+-- Apply overrides.
+ModLuaFileAppend("data/scripts/perks/perk.lua", "mods/noita-mapcap/files/overrides/perks/perk.lua" )
\ No newline at end of file