Skip to content

Commit

Permalink
Fix vectormap swap remove
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbomber committed Jun 19, 2023
1 parent 46815a6 commit ff7f3d6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@boatbomber/windshake",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
13 changes: 7 additions & 6 deletions src/VectorMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,19 @@ function VectorMap:RemoveObject(voxelKey: Vector3, object: any)
return
end

for index, storedObject in voxel[className] do
local classBucket = voxel[className]
for index, storedObject in classBucket do
if storedObject == object then
-- Swap remove to avoid shifting
local n = #voxel
voxel[index] = voxel[n]
voxel[n] = nil
local n = #classBucket
classBucket[index] = classBucket[n]
classBucket[n] = nil
break
end
end

-- Remove empty class group
if #voxel[className] == 0 then
-- Remove empty class bucket
if #classBucket == 0 then
voxel[className] = nil

-- Remove empty voxel
Expand Down
2 changes: 1 addition & 1 deletion wally.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "boatbomber/windshake"
description = "High performance wind effect for leaves and foliage"
version = "2.0.0"
version = "2.0.1"
license = "MIT"
authors = ["boatbomber (https://boatbomber.com)"]
registry = "https://github.com/upliftgames/wally-index"
Expand Down

0 comments on commit ff7f3d6

Please sign in to comment.