How can I script a routine to check for walls?
I dont think they appear in elements.default_PT...
Or is there an indirect way?
The use is this: I am making a particle type with procedurally determined velocities. I need the script to recognize when the particle is beside a wall.
One thing I tried so far is to test sim.partID. If it is nil, act as if is was a wall. The problem is absence of particles is interpreted as a wall...
Try tpt.get_wallmap(x, y). Note that the coordinates are cell coordinates. To convert from particle coordinates to cell coordinates, use math.floor(math.floor([x or y] + 0.5) / 4). I know it looks ugly but it's what it is :/ Here are the kinds of answers you can get from that function (it returns a number). I haven't found constants mapping them in the Lua API so you'll have to hardcode these. The division by 4 may seem arbitrary above but it's actually the CELL size (it's called that in the source), but I haven't found a constant in the Lua API for that either.
And here I was trying to do everything with the new API, thinking it was intended as a replacement and that tpt. functions would eventually be deprecated and incompatible.
Good to know it is not the case.
Thank you!