Skip to content

Incorrect _size values for deferred spawn/despawn 0.9.0-beta.0 #158

@TheyCallMeRyan

Description

@TheyCallMeRyan

Description

Image
Can get negative sizes when despawning and then immediately spawning within the same commit commands.

This is caused by the spawnAt functionality:

	if not willBeDeleted then
		self._size += 1
	end

executeDespawn will still occur even if a later spawnAt command it executed, and executeDespawn will always decrement the _size by 1, even if markedForDeletion is no longer set.

Steps to reproduce

world:commitCommands()
world:spawnAt(1)
world:commitCommands()
world:despawn(1)
world:spawnAt(1)
world:commitCommands()
world:despawn(1)
world:spawnAt(1)
world:commitCommands()
world:despawn(1)
world:spawnAt(1)
world:commitCommands()
print(world:size())

Expected behavior

Keep the appropriate _size value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions