Page 1 of 1

[CSM] Distancer

Posted: Sat Dec 15, 2018 19:04
by Clyde
Simple, short, Distancer.

Distancer is a Client-Side Mod, which should help you to build in Minetest.
This Mod measures distances or show's you the current Mapblock of your Position.

Complete reworked and a new command now available.
Added a dynamic Helpsystem.

General Commands:
  • .dis show_mapblock | Shows you the Mapblocknumber of your current Position.
  • .dis who | Lists the Names of the (online) Player.
  • .dis change_safe_dead | Turns the safe_dead on or off or show's the status of safe_dead.
Marker Commands:
  • .dis mark | Shows you the current stored Marker.
  • .dis mark -s | Set's the Marker to your current Position.
  • .dis mark -m | Shows you the Distance between your current Position and the (valid) Marker.
  • .dis mark -p | Shows you a vector of the Distance between your current Position and the (valid) Marker.
  • .dis mark -w X,Y,Z | Writes a manual given Position to the Marker. Example: .dis mark -w 50,-10,100 - Set's the Marker to the Position 50,-10,100.
HUD Commands:
  • .dis hud on|off | Turns all HUD's of Distancer on or off.
  • .dis hud_mapblock on|off | Turns the HUD for the current Mapblock on or off.
  • .dis hud_measure on|off | Turns the HUD to measure distances on or off.
  • .dis hud_waypoint on|off | Turns the HUD for the Waypoint on or off.
  • .dis hud_waypoint -c <color> | Changes the Color of the Waypoint to <color> (like green) or shows the available colors.
  • .dis hud_set | Shows you the current Position of the HUD.
  • .dis hud_set -r | Resets the Position of the HUD to default.
  • .dis hud_set -w .x,.y | Set's the Position of the HUD to the given Values. A Value of 0 left the Position unchanged.
  • .dis hud_speed | Shows you the current Refreshspeed of the HUD in Seconds.
  • .dis hud_speed Number | Changes the Refreshspeed of the HUD in Seconds. 0 turns the HUD off.
Source:
https://github.com/acmgit/distancer

Download:
Release for 5.x.x:
https://github.com/acmgit/distancer/archive/3.3.zip

Depends:
nothing

License:
GPL 3.0

How to install:
Move the folder to your clientmods directory of your minetest-folder.
Then activate the mod in your mods.conf.
Important: Not the mod.conf inside of the mod!!
Image

for Modwriter
API-Documentation as md
API-Documentation as txt

Older version:
Will not developed again by the Author:

Download:
Release for >= 0.4.15.
https://github.com/acmgit/distancer/archive/1.0.zip

Have Fun with it.
Greetings, Clyde.

Re: [CSM] Distancer

Posted: Mon Dec 17, 2018 11:33
by nrz
Nice job,
Can you try to implement this using a CSM HUD ? It can be nice to au refresh data on screen using that

Re: [CSM] Distancer

Posted: Wed Dec 19, 2018 20:59
by Clyde
Update: Command .waypoint renamed to .marker
nrz wrote:Nice job,
Thanks a lot.
nrz wrote: Can you try to implement this using a CSM HUD ? It can be nice to au refresh data on screen using that
Good idea, but ....
Does support the 0.4.x Clients of MT the CSM HUD?

If yes, then i do something wrong and get an Error, that i attempt to index a field, what is an nil-value ..
I tried it with:

Code: Select all

minetest.localplayer:hud_add(def)
and

Code: Select all

minetest.localplayer.hud_add(def)
Greetings, Clyde.

Re: [CSM] Distancer

Posted: Thu Dec 20, 2018 23:19
by Clyde
Update:
New Release but only for MT 5.x.x.
Now the Distancer has a HUD, which can be turned on or off.

The new Commands for this Release are:

.distancer_hud_mapblock on|off
.distancer_hud_measure on|off

Greetings, Clyde.

Re: [CSM] Distancer

Posted: Sat Dec 22, 2018 12:42
by Clyde
Update:
Version 2.2

Command to changes the Position of the HUD added.
.distancer_hud_change | Shows you the current Position of the HUD in Chat.
.distancer_hud_change -r | Reset's the Position of the HUD to default.
.distancer_hud_change -w .x,.y | Changes the Position of the HUD to the given Positions. A Value of 0 does nothing on the axis.
.distancer_hud_speed | Shows you the current Refreshspeed of the HUD in Seconds.
.distancer_hud_speed Number | Changes the Refreshspeed of the HUD in Seconds. 0 turns the HUD off.

All Commands now starts with .distancer_XXXX.
Update of the HUD now about minetest.after().

Greetings Clyde.

Re: [CSM] Distancer

Posted: Sat Dec 22, 2018 16:36
by Lone_Wolf
Clyde wrote:Update:
Version 2.2

Command to changes the Position of the HUD added.
.distancer_hud_change | Shows you the current Position of the HUD in Chat.
.distancer_hud_change -r | Reset's the Position of the HUD to default.
.distancer_hud_change -w .x,.y | Changes the Position of the HUD to the given Positions. A Value of 0 does nothing on the axis.
.distancer_hud_speed | Shows you the current Refreshspeed of the HUD in Seconds.
.distancer_hud_speed Number | Changes the Refreshspeed of the HUD in Seconds. 0 turns the HUD off.

All Commands now starts with .distancer_XXXX.
Update of the HUD now about minetest.after().

Greetings Clyde.
It might be a good idea to make the commands shorter. It's annoying to have to sit there and type a big long cmd just to do one simple little thing.
Suggestions:
  • Replace distancer_hud with dhud
  • Maybe replace change with s or set (Not really needed because `change` is pretty easy to type quickly)
Nice mod btw. It'll be useful for builders planning out their projects

Re: [CSM] Distancer

Posted: Sun Dec 23, 2018 11:36
by Clyde
Hello,

i like your idea with the shorter commands, it's nothing what is carved in stone, so i think, i will do it so.
Thx for your proposal, Lone_Wolf.

Greetings Clyde.

Re: [CSM] Distancer

Posted: Fri Dec 28, 2018 22:35
by Clyde
Update:

Commands now shorter .dhud ....
Command .dhud on|off added. Turns all HUD's of the Distancer on or off.

Greetings. Clyde.

Re: [CSM] Distancer

Posted: Fri Dec 28, 2018 23:47
by Lone_Wolf
Clyde wrote:Update:

Commands now shorter .dhud ....
Command .dhud on|off added. Turns all HUD's of the Distancer on or off.

Greetings. Clyde.
Awesome. Thanks!

Re: [CSM] Distancer

Posted: Fri Dec 28, 2018 23:56
by Clyde
You're Welcome, Lone_Wolf ;-).

Update:
Hud for Waypoint added. You can see a Hud in red with <Marker> on the Screen.
Of course is this Hud on and off switchable.
.dhud_waypoint on|off

Greetings Clyde.

Re: [CSM] Distancer

Posted: Mon Jan 14, 2019 15:31
by Clyde
Update: Only for MT 5.x.x
With Version 2.7, added a API to Distancer for Modwriter.

Var:
  • dst.ver | Version Number of the loaded Distancer.
  • dst.rev | Revision Number of the loaded Distancer.
  • dst.name | Name of the Mod.
API:
  • dst.send_pos(name, position) | name = playername, position = string like "0,0,0". Set's the Marker to the Position "x,y,z".
Greetings, Clyde.

Re: [CSM] Distancer

Posted: Sat Aug 03, 2019 09:17
by u18398
Clyde wrote: How to install:
Move the folder to your clientmods directory of your minetest-folder.
Then activate the mod in your mod.conf.
Hi clyde, this works pretty good. At least once I figured out it is the mods.conf and not mod.conf :)
A player in Jungle wanted to have this to find boundaries of mapblocks for his technic stuff. It took us
a while to get it to work.

Maybe it should be mentioned also that mods.conf must be in the ~/.minetest/clientmods folder
and not in the folder of the mod. Also clientmods must be enabled in the client: /client/network/clientmodding = true

Re: [CSM] Distancer

Posted: Sat Aug 03, 2019 17:26
by Clyde
Hello Gundul,

of course, you're right, it's the mods.conf in the clientmods directory and not the mod.conf inside the mod.
Thanks for reporting this, i've fixed it and deactivated my little trap, sorry for this ;-).

And yes, some day's ago, i helped Pixalou with the install of this mod on linux mint and figured out, that he had the folder for the mods in /var and not in .minetest.
We was doing the same procedure and then he found a second minetest-folder in /var, there the mod was working.

Greetings, Clyde.

Re: [CSM] Distancer

Posted: Sat Aug 03, 2019 20:08
by Lone_Wolf

Re: [CSM] Distancer

Posted: Sun Mar 22, 2020 00:30
by Clyde
Update: Version 3.1

Complete reworked code.
New function safe_dead added.
Easy to add commands for the Future.
Added a dynamic Helpsystem.

The new version has now a safe_dead-mode. When this mode is on and you die in the game, the distancer set's the waypoint to your position of death. But the distancer don't forget the old waypoint, so you can go back to your body, collect your bones and restore the waypoint to your old position.

The new version uses only one chat command to control the entire distancer.

Of course, you can every time turn on or off this mode.

Greetings, Clyde.

Re: [CSM] Distancer

Posted: Thu Mar 26, 2020 09:43
by Clyde
Update:

Not a new release, but i have fixed a silly bug, if you use the last release, update it with the repository.

Greetings, Clyde.

Re: [CSM] Distancer

Posted: Thu Nov 19, 2020 16:25
by Niden
is there a way to mark multiple points?

Re: [CSM] Distancer

Posted: Fri Nov 20, 2020 15:07
by Clyde
Distance supports only 1 Waypoint, but you can take a look at the module mark,
there are the code for the waypoints.

It would be possible to support more than 1 waypoint, but the handling would be much more complicated.
You can create a new module for distancer and at the end of the init.lua add:

Code: Select all

dofile("cmd_<your modulname>")
The name of the module have to start with cmd_<modulname> and register in the module your help,
like the other modules are doing.
Then the distancer supports your new module and you can work with it.

You could use the function

Code: Select all

distancer.calc_distance_pos(pos_1, pos_2)
to get more waypoints.

Greetings, Clyde.

Re: [CSM] Distancer

Posted: Fri Nov 20, 2020 20:03
by Clyde
Update:

Added a API-Documentation of distancer for Developers.
You can find now api.md or api.txt for plain txt.

Greetings, Clyde.

Re: [CSM] Distancer

Posted: Mon Nov 23, 2020 22:49
by Ignaramico
I dont know if its normal (or just a problem of mine), but when you put the the command without any parameter (just the .dis) it crashes the game, saying that sayd command had a value of nil (or soemthing like that)

Re: [CSM] Distancer

Posted: Tue Nov 24, 2020 17:12
by Clyde
No, this seems to be a bug, i will take a look on it, thanks for reporting.

Re: [CSM] Distancer

Posted: Tue Nov 24, 2020 17:54
by Clyde
It looks like, you use an older version of distancer. But nevermind, i found another bug, that i fixed.
Please update to version 3.3 or directly from github, then you should work without any troubles.

Greetings, Clyde.