[Mod] HUD Notify [hud_notify]

Post Reply
User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

[Mod] HUD Notify [hud_notify]

by ANAND » Post

HUD Notify is a very simple mod that comprises of just one command /notify, which is very similar to the builtin /msg command, except for the fact that /notify displays a message using HUD elements (instead of displaying via chat) for better noticeability. Due to the higher potential for abuse, the use of this command is restricted to moderators and above.

Syntax:

Code: Select all

/notify <player_name> <msg>
Example:

Code: Select all

/notify LegendaryGriefer Stop griefing or face a ban!
minetest.conf

Code: Select all

notify.hud_duration
This setting takes a numeric value (10 by default) in seconds, which represents the duration of the message's visibility.

Screenshot:
Image

Mod dependencies: None
License: MIT

View code
Download

EDIT: Mod has been renamed to hud_notify to resolve any naming conflicts with existing / future mods
Last edited by ANAND on Fri May 11, 2018 02:13, edited 3 times in total.
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

Re: [Mod] Notify [notify]

by ExeterDad » Post

I like the concept :)
But a potential downfall (no pun intended) is a player who is sneaking over lava, or any other dangerous place would lose control of all controls when the formspec appears. They would fall.
Perhaps check the players controls and detect the use of "sneak" at least before displaying? And que the PM to be displayed later if "sneak" is in use?

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Notify [notify]

by Krock » Post

Alternatively you could move the text to a HUD element, which then can be dismissed using a chat command.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

Re: [Mod] Notify [notify]

by ANAND » Post

ExeterDad wrote:I like the concept :)
But a potential downfall (no pun intended) is a player who is sneaking over lava, or any other dangerous place would lose control of all controls when the formspec appears. They would fall.
Perhaps check the players controls and detect the use of "sneak" at least before displaying? And que the PM to be displayed later if "sneak" is in use?
Very true, and just when I was looking for a more elegant solution...
Krock wrote:Alternatively you could move the text to a HUD element, which then can be dismissed using a chat command.
... HUD element it is! :)

I'll get it done within the next 24 hours.
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Notify [notify]

by Stix » Post

very useful, but id like an option to be notified with chat under your crosshairs and you cant type /view to see the notification, and a bell sound for notifications.
Hey, what can i say? I'm the bad guy.

User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

Re: [Mod] Notify [notify]

by ANAND » Post

Stix wrote:very useful, but id like an option to be notified with chat under your crosshairs and you cant type /view to see the notification, and a bell sound for notifications.
Good idea, but I'm afraid it won't adhere to the "theme" of this mod, which is fast, quick and noticeable. I'm in the process of converting the formspec into an HUD element, which automatically disappears when a custom command, let's say, /ok, is entered.

I am open to other suggestions to dismiss the HUD, which is more elegant than having to type /ok in the chat; maybe another HUD element within the message element itself?
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [Mod] Notify [notify]

by Stix » Post

ANAND wrote:
Stix wrote:very useful, but id like an option to be notified with chat under your crosshairs and you cant type /view to see the notification, and a bell sound for notifications.
Good idea, but I'm afraid it won't adhere to the "theme" of this mod, which is fast, quick and noticeable. I'm in the process of converting the formspec into an HUD element, which automatically disappears when a custom command, let's say, /ok, is entered.

I am open to other suggestions to dismiss the HUD, which is more elegant than having to type /ok in the chat; maybe another HUD element within the message element itself?
have the notification disapear from the hud after 30 seconds, so no clunky controls.
Hey, what can i say? I'm the bad guy.

User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

Re: [Mod] Notify [notify]

by ANAND » Post

Stix wrote:have the notification disapear from the hud after 30 seconds, so no clunky controls.
That's precisely what I'm doing right now, but 30 secs. is too long IMO. I'll make it read a setting from minetest.conf, and if it doesn't exist, it defaults to 10 seconds.
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

Re: [Mod] Notify [notify]

by ANAND » Post

Major update:
  • Re-implemented using HUD elements
  • Made duration of message visibility configurable (by means of a numeric setting in minetest.conf)
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

Re: [Mod] HUD Notify [hud_notify]

by ANAND » Post

Update:

Mod has been renamed to hud_notify to resolve potential naming conflicts.
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

User avatar
PETE
Member
Posts: 74
Joined: Thu Sep 21, 2017 05:21
GitHub: PETE
In-game: PETE-Randomizer
Location: IDK Ctf server

Re: [Mod] HUD Notify [hud_notify]

by PETE » Post

is this only used by moderators and admin because people can spam this to people
Whats the trick? I wish I knew

User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

Re: [Mod] HUD Notify [hud_notify]

by ANAND » Post

Yes, this requires kick, ban privs (as mentioned in the first post).
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

User avatar
BillyS
Member
Posts: 29
Joined: Thu May 31, 2018 17:10
GitHub: Billy-S
IRC: BillyS
In-game: BillyS
Location: By my computer
Contact:

Re: [Mod] HUD Notify [hud_notify]

by BillyS » Post

Sweet. This is very useful for players who have turned their chat off (Especially if they do so to ignore an admin or moderator).
<SHAMELESS PLUG> Play on my server Blocky Survival! It's unique! </SHAMELESS PLUG>

User avatar
ANAND
Member
Posts: 335
Joined: Sun Jan 28, 2018 12:54
GitHub: magnetar47
IRC: MAGNETAR ANAND
In-game: ANAND and all names with Tomato
Location: India
Contact:

Re: [Mod] HUD Notify [hud_notify]

by ANAND » Post

Major Update

  • Added a setting [hud_notify.hide_sender] which toggles the showing of sender name.
  • Added support for server-wide notifications using [/notify_all <msg>].
  • Numerous other improvements to the code.
My Mods

cdb_NXKPOcRlgUGdMyf8uLoUQvnMGIfuaHmp

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests