Page 1 of 1

Best way to cancel a building?

Posted: Sat Dec 15, 2018 2:14 am
by DaveMcW
I want to prevent a player from placing a certain building under certain circumstances. Collision mask is not precise enough, and the on_pre_player_built_entity event does not exist. So I have to listen for the on_built_entity event and the destroy the building and refund the build cost.

Has any other mod solved this problem?

Re: Best way to cancel a building?

Posted: Tue Dec 18, 2018 10:01 am
by bobingabout
If you don't mind waiting a month for 0.17, you could ask to see if on_pre_player_built_entity could be implemented.

Re: Best way to cancel a building?

Posted: Thu Dec 20, 2018 7:49 am
by Rseding91
bobingabout wrote:
Tue Dec 18, 2018 10:01 am
If you don't mind waiting a month for 0.17, you could ask to see if on_pre_player_built_entity could be implemented.
That's what the on-put-item event is. It literally fires before building an entity and only before building an entity.

Re: Best way to cancel a building?

Posted: Thu Dec 20, 2018 2:04 pm
by DaveMcW
Thanks for the hint, it seems Nexela is using the same approach as me because on_put_item doesn't work.
viewtopic.php?t=29887