mirror of
				https://github.com/Ukendio/jecs.git
				synced 2025-11-04 10:59:18 +00:00 
			
		
		
		
	Fix entity lookup
This commit is contained in:
		
							parent
							
								
									06aba5548f
								
							
						
					
					
						commit
						6ebac90fd9
					
				
					 1 changed files with 11 additions and 7 deletions
				
			
		| 
						 | 
					@ -5,15 +5,19 @@ local collect = require("../collect")
 | 
				
			||||||
local client_ids = {}
 | 
					local client_ids = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local function ecs_map_get(world: types.World, id: types.Entity)
 | 
					local function ecs_map_get(world: types.World, id: types.Entity)
 | 
				
			||||||
	local deserialised_id = 0
 | 
						local deserialised_id = client_ids[id]
 | 
				
			||||||
 | 
						if not deserialised_id then
 | 
				
			||||||
	if not world:exists(id) or not world:contains(id) then
 | 
							if world:has(id, jecs.Name) then
 | 
				
			||||||
		deserialised_id = world:entity(id)
 | 
								deserialised_id = world:entity(id)
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								if world:exists(id) then
 | 
				
			||||||
 | 
									deserialised_id = world:entity()
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
									deserialised_id = world:entity(id)
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
		client_ids[id] = deserialised_id
 | 
							client_ids[id] = deserialised_id
 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		deserialised_id = client_ids[id]
 | 
					 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
					 | 
				
			||||||
	return deserialised_id
 | 
						return deserialised_id
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue