Carpet

Carpet

2M Downloads

Scarpet: Add `__on_player_placing_block` (name subject to change)

James103 opened this issue ยท 6 comments

commented

Currently, __on_player_places_block is fired after the player places a block, not before. According to #1497, changing this "would involve a significant behaviour change, breaking many scripts".

As a compromise, a new event __on_player_places_block_pre should be added, which functions just like __on_player_places_block, the only difference being it fires before the block is placed.

By doing this, existing scripts can keep the current behavior, while new scripts can take advantage of the new event and the features in #1497 to block the placement of a block under certain conditions.

commented

100% support.

commented

Yeah, adding a new event is probably the way to go, i'm just not sure what name it would have

commented

maybe __on_player_placing_block cos it's right as the player is placing the block, as opposed to after they place it?

commented

This can be closed now, as of 24b9c38

commented

It was added in the cancellation PR, triggering before the placing, allowing to cancel. The old event __on_player_places_block remained untouched.

commented

Was the event added? Or the current one modified?