mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-18 17:17:31 +00:00
Start entity capturing based on mod settings
- Rename disable-entity-components mod setting to modify-entities - Add IsPlayer and IsInvisible methods to entity API - Don't modify the player entity
This commit is contained in:
parent
640a241d38
commit
6becf72420
@ -322,7 +322,8 @@ local function captureModifyEntities(file, modify, x, y, radius)
|
||||
end
|
||||
|
||||
-- Make sure to only modify entities when they are encountered the first time.
|
||||
if modify and not rootEntity:HasTag("MapModified") then
|
||||
-- Also, don't modify the player.
|
||||
if modify and not rootEntity:IsPlayer() and not rootEntity:HasTag("MapModified") then
|
||||
-- Disable some components.
|
||||
for _, componentTypeName in ipairs(Config.ComponentsToDisable) do
|
||||
local components = rootEntity:GetComponents(componentTypeName)
|
||||
@ -506,6 +507,11 @@ function Capture:StartCapturing()
|
||||
Message:ShowRuntimeError("StartCapturing", string.format("Unknown capturing mode %q", tostring(mode)))
|
||||
end
|
||||
|
||||
-- Start entity capturing and modification, if wanted.
|
||||
local captureEntities = ModSettingGet("noita-mapcap.capture-entities")
|
||||
local modifyEntities = ModSettingGet("noita-mapcap.modify-entities")
|
||||
self:StartCapturingEntities(captureEntities, modifyEntities)
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -340,6 +340,20 @@ end
|
||||
|
||||
-- TODO: Add missing Noita API methods and functions.
|
||||
|
||||
---
|
||||
---@return boolean
|
||||
function NoitaEntity:IsPlayer()
|
||||
return IsPlayer(self.ID)
|
||||
end
|
||||
|
||||
---
|
||||
---@return boolean
|
||||
function NoitaEntity:IsInvisible()
|
||||
return IsInvisible(self.ID)
|
||||
end
|
||||
|
||||
-- TODO: Add missing Noita API methods and functions.
|
||||
|
||||
-------------------------
|
||||
-- JSON Implementation --
|
||||
-------------------------
|
||||
|
@ -263,7 +263,7 @@ modSettings = {
|
||||
not_setting = true,
|
||||
},
|
||||
{
|
||||
id = "disable-entity-components",
|
||||
id = "modify-entities",
|
||||
ui_name = " Modify entities",
|
||||
ui_description = "If enabled, the mod will disable some components of all encountered entities.\nThis will:\n- Disable AI\n- Disable falling\n- Disable hovering and rotation animations\n- Reduce explosions\n \nThis may slow down things a bit.\nAnd it may make Noita more likely to crash.\nUse at your own risk.",
|
||||
value_default = false,
|
||||
|
Loading…
Reference in New Issue
Block a user