Is there a function that I can use in the game to check the type of tile under an entity?
I am trying to make an amphibious vehicle faster on land and slower on water, and hovercraft faster on water and slower on land.
Thanks.
Check tile under entity?
Re: Check tile under entity?
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Re: Check tile under entity?
What does this function return? The tile name? Sorry if I didn't see it on the api page, I really looked everywhere.
Re: Check tile under entity?
It returns a LuaTile:

See here: http://lua-api.factorio.com/0.12.30/LuaTile.html
To get to the name you would use surface.get_tile(x, y).name.

See here: http://lua-api.factorio.com/0.12.30/LuaTile.html
To get to the name you would use surface.get_tile(x, y).name.
Re: Check tile under entity?
Thanks, it worked!, But now I can't find how to change the sprite of a car when it is in water...
Is that even possible to do in control.lua?
Edit: Is it possible to access the sprite table of an already loaded entity?
Is that even possible to do in control.lua?
Edit: Is it possible to access the sprite table of an already loaded entity?
Re: Check tile under entity?
I don't think you can change the sprite of an entity after it was loaded in the game, but you could replace that entity with a second entity, identical except it uses another sprite. You would need to change the entity back to its original entity when it goes on land though. Also, if your entity has an inventory, you would need to copy that inventory too.bloc97 wrote:Thanks, it worked!, But now I can't find how to change the sprite of a car when it is in water...
Is that even possible to do in control.lua?
Edit: Is it possible to access the sprite table of an already loaded entity?
Re: Check tile under entity?
Thanks... Though that would be a very "brute force" way... And it could bug easily in multiplayer...