mirror of
				https://github.com/Ukendio/jecs.git
				synced 2025-10-31 17:20:32 +00:00 
			
		
		
		
	Initial commit (#86)
This commit is contained in:
		
							parent
							
								
									2f0f817b08
								
							
						
					
					
						commit
						d46df8c0a0
					
				
					 3 changed files with 33 additions and 2 deletions
				
			
		|  | @ -40,6 +40,11 @@ do | |||
| 				end | ||||
| 			end) | ||||
| 
 | ||||
| 			BENCH("1 component, 7 tags", function() | ||||
| 			    for _ in world:query(H):with(G, F, E, D, C, B, A) do | ||||
| 				end | ||||
| 			end) | ||||
| 
 | ||||
| 			local e = world:entity() | ||||
| 			world:set(e, A, true) | ||||
| 			world:set(e, B, true) | ||||
|  |  | |||
|  | @ -895,6 +895,31 @@ do | |||
|         end | ||||
|     end | ||||
| 
 | ||||
|     local function world_query_with(query, ...) | ||||
|         local ids = { ... } | ||||
|         for i = #compatibleArchetypes, 1, -1 do | ||||
|  			local archetype = compatibleArchetypes[i] | ||||
|  			local records = archetype.records | ||||
|  			local shouldRemove = false | ||||
| 
 | ||||
|  			for _, id in ids do | ||||
|  			    if not records[id] then | ||||
|     				shouldRemove = true | ||||
|     				break | ||||
|  			    end | ||||
|  			end | ||||
| 
 | ||||
|  			if shouldRemove then | ||||
|  			    table.remove(compatibleArchetypes, i) | ||||
|  			end | ||||
|         end | ||||
| 
 | ||||
|         if #compatibleArchetypes == 0 then | ||||
|             return EmptyQuery | ||||
|         end | ||||
| 
 | ||||
|         return query | ||||
|     end | ||||
| 
 | ||||
|     function world_query(world: World, ...: any): Query | ||||
|     	-- breaking? | ||||
|  | @ -969,8 +994,9 @@ do | |||
|         local it = { | ||||
|             __iter = world_query_iter, | ||||
|             next = world_query_next, | ||||
|             with = world_query_with, | ||||
|             without = world_query_without, | ||||
|             replace = world_query_replace | ||||
|             replace = world_query_replace, | ||||
|         } :: any | ||||
| 
 | ||||
|         setmetatable(it, it) | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| [package] | ||||
| name = "ukendio/jecs" | ||||
| version = "0.2.3" | ||||
| version = "0.2.5" | ||||
| registry = "https://github.com/UpliftGames/wally-index" | ||||
| realm = "shared" | ||||
| include = [ | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue