Forum

> > CS2D > Scripts > Entity not showing in entity table
Forums overviewCS2D overview Scripts overviewLog in to reply

English Entity not showing in entity table

3 replies
To the start Previous 1 Next To the start

old Entity not showing in entity table

Mami Tomoe
User Off Offline

Quote
Hi!

I have two entities:
1: https://i.imgur.com/mXpqsjt.png
2: https://i.imgur.com/0EMNY5Q.png

And I'm trying to loop through all entities and get their values:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
local houses = { }
	
	-- Loop through every entity on the map and attach X and Y positions to houses table.
	for _, loc in pairs(hc.ENTITIES) do
		local tx, ty = loc.x, loc.y
		
		if entity(tx, ty, 'name') == 'house' then
			houses[tonumber(entity(tx, ty, 'trigger'))] = { 0, tx, ty }
		end
	end
	
	hc.houses.houses = houses
	
	print(hc.util.get_table_as_string(hc.houses.houses))

But I only seem to get the second one!
The first one doesn't even exist in the entity table, I've tried printing all of it to the logs.
Weird thing is that it sometimes appears when I use the test mode in the editor.

What am I doing wrong? Or is this a bug?

old Re: Entity not showing in entity table

Edik
User Off Offline

Quote
I made a test map with a zombie entity and two decal entitys.
1
2
3
4
local list=entitylist()
for _,e in pairs(list) do
   print("entity @ ("..e.x..","..e.y..") - "..entity(e.x,e.y,"typename"))
end
IMG:https://www.bilder-upload.eu/upload/b02d47-1560584966.png


I could see every entity but not the Decal.
Seems like entitylist() doesnt include Env_Decal. Looks like a bug for me, as the documentation says, that it can be read using entity.
@user DC:

old Re: Entity not showing in entity table

DC
Admin Off Offline

Quote
The way how decals work has been changed in one of the updates for performance reasons. They are no longer present as entity once the map has been loaded.

So, yes, sorry, impossible to access that data.
If you want to interact with the entity via Lua please use cs2d entity env_image or cs2d entity env_sprite instead

Will update the documentation accordingly.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview