[Mod] Limit chat by distance [0.1.2] [shout]

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

[Mod] Limit chat by distance [0.1.2] [shout]

by srifqi » Thu Jun 11, 2015 06:58

Hi!
This mod limit your message by distance so that your message only sent to player within distance boundary.

Features:
  • Limit who can hear your message by distance given in shout.DISTANCE parameter
  • A chat command /sh to broadcast your message (pay 1 stick by default, can be changed in shout.PAYMENT parameter)

See README

Github: https://github.com/srifqi/shout

Downloads:

License: CC 1.0 Universal
Dependencies: (none)

No screenshot for now!
Last edited by srifqi on Wed Jun 24, 2015 07:54, edited 3 times in total.
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Mod] Limit chat by distance [0.1] [shout]

by rubenwardy » Thu Jun 11, 2015 07:37

it might be better to do:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
math.sqrt(x * x + y * y + z * z)


https://github.com/srifqi/shout/blob/ma ... it.lua#L20

It's less square rooting (but maybe less readable, Idk) probably not worth optimising :P

chatplus can already do this, but it comes with the bloat of ignoring and inboxes, so it's good to have a standalone version (as in, doesn't provide anything else other than distance limiting). /sh having a cost, a stick, is quite interesting as a game play mechanic.
 

Diamond knight
Member
 
Posts: 262
Joined: Sun Apr 19, 2015 19:50
In-game: Diamondknight or diamond_knight

Re: [Mod] Limit chat by distance [0.1] [shout]

by Diamond knight » Thu Jun 11, 2015 16:28

sticks are kinda a little, say cheap, maybe something cheap but not almost unlimited brodcasts kinda cheap
I can never get enough MESE!!!!!!!!!

my subgame: https://forum.minetest.net/viewtopic.php?f=50&t=11901
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: [Mod] Limit chat by distance [0.1] [shout]

by srifqi » Thu Jun 11, 2015 17:19

rubenwardy wrote:it might be better to do:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
math.sqrt(x * x + y * y + z * z)


https://github.com/srifqi/shout/blob/ma ... it.lua#L20

It's less square rooting (but maybe less readable, Idk) probably not worth optimising :P

I was just copying from Minetest built-in lua. Never thought about this optimization, I already know that formula, just forgot when writing the code. :P

rubenwardy wrote:chatplus can already do this, but it comes with the bloat of ignoring and inboxes, so it's good to have a standalone version (as in, doesn't provide anything else other than distance limiting). /sh having a cost, a stick, is quite interesting as a game play mechanic.

Never heard about your mod, sorry. :D

Diamond knight wrote:sticks are kinda a little, say cheap, maybe something cheap but not almost unlimited brodcasts kinda cheap

Maybe, I should add parameter for this, so that you can easily change what we should pay.

Also, should I add a configuration per world?
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

UPDATE: [Mod] Limit chat by distance [0.1.1] [shout]

by srifqi » Sat Jun 13, 2015 00:10

UPDATE 0.1.1! (Payment Update)
Changes:
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: [Mod] Limit chat by distance [0.1] [shout]

by prestidigitator » Sat Jun 13, 2015 02:20

rubenwardy wrote:It's less square rooting (but maybe less readable, Idk) probably not worth optimising :P

Even better is to compare squares of distances and not need square roots at all. :-P
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: [Mod] Limit chat by distance [0.1] [shout]

by srifqi » Sun Jun 14, 2015 06:22

prestidigitator wrote:
rubenwardy wrote:It's less square rooting (but maybe less readable, Idk) probably not worth optimising :P

Even better is to compare squares of distances and not need square roots at all. :-P

Ah, Phytagoras Theorem!
Phytagoras Theorem wrote:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
c * c = a * a + b * b


How can I forget that? Thanks prestidigitator. Will be avaiable in next update.
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

User avatar
lag01
Member
 
Posts: 190
Joined: Sun Mar 16, 2014 03:41
GitHub: AndrejIT
IRC: lag01
In-game: lag

Re: [Mod] Limit chat by distance [0.1.1] [shout]

by lag01 » Sat Jun 20, 2015 10:11

Minetest have built-in helper: vector.distance(senderpos, recieverpos)

Good idea for taking payment for shouting, i must add it to my chat mod too!
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

Re: [Mod] Limit chat by distance [0.1.1] [shout]

by srifqi » Wed Jun 24, 2015 07:30

lag01 wrote:Minetest have built-in helper: vector.distance(senderpos, recieverpos)

Do you mean this?
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function vector.distance(a, b)
   local x = a.x - b.x
   local y = a.y - b.y
   local z = a.z - b.z
   return math.hypot(x, math.hypot(y, z))
end

You know? We (me, rubenwardy, and prestidigitator) are doing optimisation. So, rather than do math.hypot several times, we compare the distance "squared". So, we save a little bit time.

lag01 wrote:Good idea for taking payment for shouting, i must add it to my chat mod too!

Yay!
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 

User avatar
srifqi
Member
 
Posts: 508
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi

UPDATE: [Mod] Limit chat by distance [0.1.2] [shout]

by srifqi » Wed Jun 24, 2015 07:54

UPDATE 0.1.2! (Performance Update)
Change:
  • Use Phytagoras Theorem c^2 = a^2 + b^2
I'm from Indonesia! Saya dari Indonesia!
Terjemahkan Minetest!
Mods by me. Modifikasi oleh saya.

Pronounce my nick as in: es-rifqi (IPA: /es rifˈki/)
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 15 guests

cron