Is there any way to determine what caused deconstruction - player or script? And, in case it was done by a player, is it possible to check which player did it?onmarkedfordeconstruction
Called when an entity is marked for deconstruction with the Deconstruction planner or via script.
Contains entity, Lua/Entity of the entity marked
Determining source of deconstruction order
Determining source of deconstruction order
Wiki says:
My mods
Re: Determining source of deconstruction order
Right now, no there's not.
If you want to get ahold of me I'm almost always on Discord.
Re: Determining source of deconstruction order
I assume it's for your upgrade planner?
You could get away with looping through all players in your onmarkedfordeconstruction function. If no player has the deconstruction planner in hand you can go ahead and upgrade, else you can print a message to the player with the upgrade planner to try again. It's a bit ugly, but i guess it should rarely happen, since all the events are raised in 1 tick?
You could get away with looping through all players in your onmarkedfordeconstruction function. If no player has the deconstruction planner in hand you can go ahead and upgrade, else you can print a message to the player with the upgrade planner to try again. It's a bit ugly, but i guess it should rarely happen, since all the events are raised in 1 tick?
Re: Determining source of deconstruction order
There would be a problem if more than one player has upgrade planner in hand if these players are not in same team. Still, I think there is no better way to do that, so I might try doing it that way, thanks for the suggestion.Choumiko wrote:I assume it's for your upgrade planner?
You could get away with looping through all players in your onmarkedfordeconstruction function. If no player has the deconstruction planner in hand you can go ahead and upgrade, else you can print a message to the player with the upgrade planner to try again. It's a bit ugly, but i guess it should rarely happen, since all the events are raised in 1 tick?
Edit: I just realized that it is not going to work. Example: one player has upgrade planner, another player has deconstruction planner. If player with upgrade planner marks an area, I can't just display the message, I need to cancel deconstruction orders. On other hand, if a player with deconstruction planner was the reason for event call, I can't cancel deconstruction order. Anyway, I don't think it will work well if I can't determine who actually used a planner
My mods