[CSM] Distancer

Post Reply
User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

[CSM] Distancer

by Clyde » Post

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.
Last edited by Clyde on Tue Nov 24, 2020 18:08, edited 23 times in total.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

nrz
Developer
Posts: 131
Joined: Sat Feb 07, 2015 17:16
GitHub: nerzhul
IRC: nrzkt
In-game: nrz
Location: France
Contact:

Re: [CSM] Distancer

by nrz » Post

Nice job,
Can you try to implement this using a CSM HUD ? It can be nice to au refresh data on screen using that

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] Distancer

by Lone_Wolf » Post

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
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

Update:

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

Greetings. Clyde.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] Distancer

by Lone_Wolf » Post

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!
My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

u18398

Re: [CSM] Distancer

by u18398 » Post

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

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Lone_Wolf
Member
Posts: 2576
Joined: Sun Apr 09, 2017 05:50
GitHub: LoneWolfHT
IRC: LandarVargan
In-game: LandarVargan

Re: [CSM] Distancer

by Lone_Wolf » Post

My ContentDB -|- Working on CaptureTheFlag -|- Minetest Forums Dark Theme!! (You need it)

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

Niden
Member
Posts: 26
Joined: Wed Apr 29, 2020 23:37
GitHub: Niden1
In-game: Niden
Location: Pacific Ocean

Re: [CSM] Distancer

by Niden » Post

is there a way to mark multiple points?

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

Update:

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

Greetings, Clyde.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

Ignaramico
Member
Posts: 78
Joined: Fri Sep 04, 2020 21:23
GitHub: ignaramico

Re: [CSM] Distancer

by Ignaramico » Post

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)

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

No, this seems to be a bug, i will take a look on it, thanks for reporting.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

User avatar
Clyde
Member
Posts: 222
Joined: Sat Jul 30, 2016 14:23
GitHub: acmgit
In-game: clyde

Re: [CSM] Distancer

by Clyde » Post

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.
My Server: Welcome to Zeitsprung - deadsoft.org:49152 Jungle The next Gundul - jungle-tng.deadsoft.org:49152

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest