mirror of
				https://github.com/Ukendio/jecs.git
				synced 2025-11-04 10:59:18 +00:00 
			
		
		
		
	Merge with main branch
This commit is contained in:
		
						commit
						611101b309
					
				
					 1 changed files with 18 additions and 16 deletions
				
			
		| 
						 | 
					@ -16,7 +16,6 @@ type ArchetypeEdge = {
 | 
				
			||||||
	remove: Archetype,
 | 
						remove: Archetype,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
type Archetype = {
 | 
					type Archetype = {
 | 
				
			||||||
	id: number,
 | 
						id: number,
 | 
				
			||||||
	edges: { [i53]: ArchetypeEdge },
 | 
						edges: { [i53]: ArchetypeEdge },
 | 
				
			||||||
| 
						 | 
					@ -37,7 +36,7 @@ type EntityIndex = { dense: { [i24]: i53 }, sparse: { [i53]: Record } }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ArchetypeRecord = {
 | 
					type ArchetypeRecord = {
 | 
				
			||||||
	count: number,
 | 
						count: number,
 | 
				
			||||||
	column: number
 | 
						column: number,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ArchetypeMap = {
 | 
					type ArchetypeMap = {
 | 
				
			||||||
| 
						 | 
					@ -723,6 +722,7 @@ local Arm = function(self: Query, ...)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
local world_query
 | 
					local world_query
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
 | 
					    local empty_list = {}
 | 
				
			||||||
    local EmptyQuery: Query = {
 | 
					    local EmptyQuery: Query = {
 | 
				
			||||||
       	__iter = function(): Item
 | 
					       	__iter = function(): Item
 | 
				
			||||||
            return noop
 | 
					            return noop
 | 
				
			||||||
| 
						 | 
					@ -733,7 +733,7 @@ do
 | 
				
			||||||
        with = Arm,
 | 
					        with = Arm,
 | 
				
			||||||
       	without = Arm,
 | 
					       	without = Arm,
 | 
				
			||||||
        archetypes = function()
 | 
					        archetypes = function()
 | 
				
			||||||
            return {}
 | 
					            return empty_list
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -998,7 +998,7 @@ do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        local function query_init(query)
 | 
					        local function query_init(query)
 | 
				
			||||||
            if init and drain then
 | 
					            if init and drain then
 | 
				
			||||||
                return
 | 
					                return true
 | 
				
			||||||
            end
 | 
					            end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            init = true
 | 
					            init = true
 | 
				
			||||||
| 
						 | 
					@ -1065,18 +1065,19 @@ do
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        local function world_query_without(query, ...)
 | 
					        local function world_query_without(query, ...)
 | 
				
			||||||
                local withoutComponents = { ... }
 | 
					                local N = select("#", ...)
 | 
				
			||||||
          		for i = #compatible_archetypes, 1, -1 do
 | 
					          		for i = #compatible_archetypes, 1, -1 do
 | 
				
			||||||
         			local archetype = compatible_archetypes[i]
 | 
					         			local archetype = compatible_archetypes[i]
 | 
				
			||||||
         			local records = archetype.records
 | 
					         			local tr = archetype.records
 | 
				
			||||||
         			local shouldRemove = false
 | 
					         			local shouldRemove = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         			for _, componentId in withoutComponents do
 | 
					                    for j = 1, N do
 | 
				
			||||||
                        if records[componentId] then
 | 
					                        local id = select(i, ...)
 | 
				
			||||||
           					shouldRemove = true
 | 
					                        if tr[id] then
 | 
				
			||||||
           					break
 | 
					            				shouldRemove = true
 | 
				
			||||||
                        end
 | 
					            				break
 | 
				
			||||||
         			end
 | 
					         			    end
 | 
				
			||||||
 | 
					                    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         			if shouldRemove then
 | 
					         			if shouldRemove then
 | 
				
			||||||
                        local last = #compatible_archetypes
 | 
					                        local last = #compatible_archetypes
 | 
				
			||||||
| 
						 | 
					@ -1139,18 +1140,19 @@ do
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        local function world_query_with(query, ...)
 | 
					        local function world_query_with(query, ...)
 | 
				
			||||||
                local with = { ... }
 | 
					                local N = select("#", ...)
 | 
				
			||||||
                for i = #compatible_archetypes, 1, -1 do
 | 
					                for i = #compatible_archetypes, 1, -1 do
 | 
				
			||||||
         			local archetype = compatible_archetypes[i]
 | 
					         			local archetype = compatible_archetypes[i]
 | 
				
			||||||
         			local tr = archetype.records
 | 
					         			local tr = archetype.records
 | 
				
			||||||
         			local shouldRemove = false
 | 
					         			local shouldRemove = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         			for _, id in with do
 | 
					                    for j = 1, N do
 | 
				
			||||||
         			    if not tr[id] then
 | 
					                        local id = select(i, ...)
 | 
				
			||||||
 | 
					                        if not tr[id] then
 | 
				
			||||||
            				shouldRemove = true
 | 
					            				shouldRemove = true
 | 
				
			||||||
            				break
 | 
					            				break
 | 
				
			||||||
         			    end
 | 
					         			    end
 | 
				
			||||||
         			end
 | 
					                    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         			if shouldRemove then
 | 
					         			if shouldRemove then
 | 
				
			||||||
                        local last = #compatible_archetypes
 | 
					                        local last = #compatible_archetypes
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue