I check a resource (only resource collision layer) against a cliff (not in resource collision layer) which should return false, but it returns true.
Am I missing something here?
[2.0.23] entity_prototype_collides returns true but shouldnt
Re: [2.0.23] entity_prototype_collides returns true but shouldnt
They are likely going to need to see your source code. It takes time even for them to go through API's and figure out steps you are trying to do, of which you could have made typos too.
Re: [2.0.23] entity_prototype_collides returns true but shouldnt
There is no more information in the code:Natha wrote: Sat Dec 07, 2024 9:59 pm I check a resource (only resource collision layer) against a cliff (not in resource collision layer) which should return false, but it returns true.
Am I missing something here?
Code: Select all
surface.entity_prototype_collides("iron-ore", cliff.position)
Re: [2.0.23] entity_prototype_collides returns true but shouldnt
Cannot reproduce.
Re: [2.0.23] entity_prototype_collides returns true but shouldnt
I figured out that it happens on tiles adjacent to out-of-map, independent if there are any other entities:
Code: Select all
for _, pos in ipairs(area_positions) do -- radius of 3 around the player; proto=copper-ore
if surface.entity_prototype_collides(proto, pos, false) and surface.get_tile(pos[1], pos[2]).name ~= "out-of-map" then
rendering.draw_circle{color={0, 0, 1}, radius=0.3, filled=true, target={pos[1]+0.5, pos[2]+0.5}, surface=surface, time_to_live=600}
end
end
- Attachments
-
- test_0.0.1.zip
- (1.07 KiB) Downloaded 14 times
Re: [2.0.23] entity_prototype_collides returns true but shouldnt
Try drawing the circles at the same position as the one given to the function and you will notice those positions are on the outside corners next to out of map tiles. Moving to not a bug.
Re: [2.0.23] entity_prototype_collides returns true but shouldnt
Thanks, didnt think about that...
But then: Is there a function that shows me how an entity prototype aligns with the tile grid, or do I have to evaluate that for myself? (2x2 entities are placed on that position without moving by [0.5, 0.5])
But then: Is there a function that shows me how an entity prototype aligns with the tile grid, or do I have to evaluate that for myself? (2x2 entities are placed on that position without moving by [0.5, 0.5])