on_pre_player_built_tile
Posted: Tue Jan 09, 2018 9:43 am
I've got a landfill mod that allows players to place all the different terrain tiles as landfill. It also allows landfill to overwrite existing terrain. I'd like to give players a landfill refund if they overwrite terrain with a similar style, e.g. overwriting a sand-1 tile with sand-2.
If there was an on_pre_player_built_tile event that was called before the surface tiles were updated then I could use that event to store the current tile values. on_pre_player_built_tile would receive the same event arguments as on_player_built_tile. Then in on_player_built_tile I could compare the stored tiles with the current surface tiles and put the appropriate landfill back in the players inventory.
I've tried using on_put_item, but that doesn't seem to be called when placing landfill. Maybe it's only for entities. If it was called then I could probably use that, assuming it is called before the surface is updated.
If there was an on_pre_player_built_tile event that was called before the surface tiles were updated then I could use that event to store the current tile values. on_pre_player_built_tile would receive the same event arguments as on_player_built_tile. Then in on_player_built_tile I could compare the stored tiles with the current surface tiles and put the appropriate landfill back in the players inventory.
I've tried using on_put_item, but that doesn't seem to be called when placing landfill. Maybe it's only for entities. If it was called then I could probably use that, assuming it is called before the surface is updated.