Forum

> > CS2D > Scripts > Entity not showing in entity table
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Entity not showing in entity table

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Entity not showing in entity table

Mami Tomoe
User Off Offline

Zitieren
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?

alt Re: Entity not showing in entity table

Edik
User Off Offline

Zitieren
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:

alt Re: Entity not showing in entity table

DC
Admin Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht