Best way to cancel a building?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Best way to cancel a building?

Post 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?

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Best way to cancel a building?

Post 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.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Best way to cancel a building?

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Best way to cancel a building?

Post 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

Post Reply

Return to “Modding help”