sbrl / Minetest-WorldEditAdditions

Extra tools and commands to extend WorldEdit for Minetest
https://worldeditadditions.mooncarrot.space/
Mozilla Public License 2.0
16 stars 3 forks source link

Implement player notification in WEA core #116

Closed VorTechnix closed 1 month ago

VorTechnix commented 1 month ago

Problem

We need our own notify_player function to stop our dependency on WorldEdit for this.

Solution

wea_core.notify(<player name>,<message>[,<message type/color>])

Message Types: error (red), warn (yellow), ok (green), info (blue), none (white)

Sub functions: notify.error, notify.warn, notify.ok, notify.info, notify.error

Options

Implement as an emitter so that other operations can be called when notify is triggered.

Additional Context

minetest.colorize is a thing.

VorTechnix commented 1 month ago

See: https://api.minetest.net/escape-sequences/ for colorize documentation.

sbrl commented 1 month ago

nice, this sounds like just the thing we need too. And colour! Oh gosh yes.

Maybe just the e.g.. [WEA] prefix or something coloured and then the message based on the level (i..e your sub functions?) if MT supports that?

VorTechnix commented 1 month ago

Maybe just the e.g.. [WEA] prefix or something coloured and then the message based on the level (i..e your sub functions?) if MT supports that?

That's the current plan!

I'll implement a demo function //test notify #119

VorTechnix commented 1 month ago

Finished base implementation (https://github.com/sbrl/Minetest-WorldEditAdditions/commit/2f1332739e4190d47c3fb4f7663f105966d71e02). Still need to implement silencing.

VorTechnix commented 1 month ago

Fully implemented with silencing and WE compatibility (c86319d94ef778a896c32bc96f8e467ebe0e84ba and 0076010f35edde62bc5f45f132b945d9d92a135f)