-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace debugger getEntity calls (#129)
- Loading branch information
1 parent
cad64b2
commit ad1714a
Showing
4 changed files
with
26 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
local function getAllComponentData(world, entity: number): { [{ [any]: any }]: { [any]: any } } | ||
local componentToData = {} | ||
|
||
local location = world.allEntities[entity] | ||
local archetype = location.archetype | ||
local indexInArchetype = location.indexInArchetype | ||
|
||
for index, field in archetype.fields do | ||
local componentId = archetype.componentIds[index] | ||
local component = world.componentIdToComponent[componentId] | ||
local data = field[indexInArchetype] | ||
|
||
componentToData[component] = data | ||
end | ||
|
||
return componentToData | ||
end | ||
|
||
return getAllComponentData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters