mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-18 17:17:31 +00:00
Change when CameraBound component is removed
Remove CameraBound component when capturing entities, but not when modifying entities
This commit is contained in:
parent
25a28c8469
commit
fd7fb31338
@ -344,6 +344,14 @@ local function captureModifyEntities(file, modify, x, y, radius)
|
||||
file:write(",\n\t", JSON.Marshal(rootEntity), "\n", "]")
|
||||
end
|
||||
|
||||
-- Disabling this component will prevent entites from being killed/reset when they go offscreen.
|
||||
-- If they are reset, all tags will be reset and we may capture these entities multiple times.
|
||||
-- This has some side effects, like longleg.xml and zombie_weak.xml will respawn every revisit, as their spawner doesn't get deleted. (Or something similar to this)
|
||||
local components = rootEntity:GetComponents("CameraBoundComponent")
|
||||
for _, component in ipairs(components) do
|
||||
rootEntity:SetComponentsEnabled(component, false)
|
||||
end
|
||||
|
||||
-- Prevent recapturing.
|
||||
rootEntity:AddTag("MapCaptured")
|
||||
end
|
||||
|
@ -5,13 +5,15 @@
|
||||
|
||||
local Vec2 = require("noita-api.vec2")
|
||||
|
||||
-- List of components that will be disabled on every encountered entity.
|
||||
-- This is only used when modifying entities, not when capturing/storing them.
|
||||
Config.ComponentsToDisable = {
|
||||
"AnimalAIComponent",
|
||||
"SimplePhysicsComponent",
|
||||
"CharacterPlatformingComponent",
|
||||
"WormComponent",
|
||||
"WormAIComponent",
|
||||
"CameraBoundComponent", -- Disabling this component will prevent entites from being killed/reset when they go offscreen. If they are reset, all tags will be reset and we may capture these entities multiple times. This has some side effects, like longleg.xml and zombie_weak.xml will respawn every revisit, as the spawner doesn't get deleted.
|
||||
--"CameraBoundComponent", -- This is already removed when capturing/storing entities. Not needed when we only modify entities.
|
||||
--"PhysicsBodyCollisionDamageComponent",
|
||||
--"ExplodeOnDamageComponent",
|
||||
--"DamageModelComponent",
|
||||
|
2
init.lua
2
init.lua
@ -92,7 +92,7 @@ end
|
||||
---Doesn't ensure any chunks around the player.
|
||||
function OnWorldInitialized()
|
||||
-- Set camera free based on mod settings.
|
||||
Modification.SetCameraFree()
|
||||
Modification.SetCameraFree() -- BUG: Calling this here has the side effect of the player entity not being loaded. Also the player UI will be gone
|
||||
end
|
||||
|
||||
---Called *every* time the game is about to start updating the world.
|
||||
|
Loading…
Reference in New Issue
Block a user