[Mod] Compass GPS [compassgps]

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Compass GPS [compassgps]

by TeTpaAka » Tue Dec 30, 2014 19:55

Maybe you could add the compass to the HUD and disable the constant replacement of the compass in the inventory. As long as there is no way to change the texture on the fly this could work as a workaround.
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Compass GPS [compassgps]

by TeTpaAka » Tue Dec 30, 2014 22:04

I made a pull request for an addition to the mod.
I thought it could be a usefull addition for RPG like worlds to be able to read bookmarks from books so you can find special places.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Dec 30, 2014 22:44

TeTpaAka wrote:Maybe you could add the compass to the HUD and disable the constant replacement of the compass in the inventory.

That would probably be best, because the way it jumps around currently is ugly and distracting.

TeTpaAka wrote:I thought it could be a usefull addition for RPG like worlds to be able to read bookmarks from books so you can find special places.

Oh wow! What an AWESOME idea! Treasure maps, books with clues, this is a WONDERFUL idea. Even in non rpg settings wouldn't it be great to be able to pass bookmarks on to others?

Let me play with it for a little bit, then I'll have this pulled in. Because this looks like a MAJOR improvement to me.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Wed Dec 31, 2014 01:20

I can create a bookmark in a book. But then when I try to read from the bookmark, it asks me to type in a name, I typed in a name, and got the below then crashed.

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
19:15:21: ACTION[ServerThread]: singleplayer uses compassgps:book, pointing at [nothing]
19:15:30: ERROR[main]: ServerError: /home/d/.minetest/mods/compassgps/books.lua:80: attempt to perform arithmetic on field 'x' (a string value)
19:15:30: ERROR[main]: stack traceback:
19:15:30: ERROR[main]:    /home/d/.minetest/mods/compassgps/books.lua:80: in function </home/d/.minetest/mods/compassgps/books.lua:43>
19:15:30: ERROR[main]:    /usr/share/minetest/builtin/game/register.lua:348: in function </usr/share/minetest/builtin/game/register.lua:336>
compassgps writing settings
19:15:30: ACTION[ServerThread]: singleplayer leaves game. List of players:
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Compass GPS [compassgps]

by TeTpaAka » Wed Dec 31, 2014 10:22

The write function didn't work correctly. I think the string modification functions (string.split) works now diffrent than a few days ago.

It should work now.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Mon Jan 05, 2015 01:15

Finally got it to working. TeTpaAka that string.split function works STRANGE now. splits on things it shouldn't. So I threw out the split all together and globalized the bookmark array in compassgps so that we could get to the actual variable with all of the fields already split. And THAT works!

So, before I release this, I've got some questions.

1st: Right now it's a "Book with bookmark" What I was thinking is that perhaps instead of a "book" this should be a map?

2nd: If people agree that a map would be a good fit, then I was thinking about something like one of these for the icon:
Image
Image

But when I tried to scale them down to 16x16 and 32x32, well, they didn't come out real well. Art is not my specialty. Anyone want to volunteer a good map image?

And again, I want to repeat, I think this is an absolutely BRILLIANT idea that will really add to the compassgps functionality and the credit goes to TeTpaAka.
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Compass GPS [compassgps]

by TeTpaAka » Mon Jan 05, 2015 11:23

How about this?

Image 16x16
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Mon Jan 05, 2015 13:07

That is lovely! Thank you TeTpaAka! What is the license?
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Compass GPS [compassgps]

by TeTpaAka » Mon Jan 05, 2015 13:12

I don't care much. What about CC BY-SA?
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Sun Feb 01, 2015 16:52

Sorry for the long delay, I got distracted with other things. working on this again. I've got this working as maps, looks really nice with the image TeTpaAka provided. I'm making a few enhancements and doing some testing. Should have an update soon.
 

pepprim
Member
 
Posts: 27
Joined: Sun Nov 02, 2014 11:47
In-game: pepprim

Re: [Mod] Compass GPS [compassgps]

by pepprim » Mon Feb 02, 2015 12:12

Hey Kilarin, lovely mod!

I would like so much can use it in Xanadu... Maybe you already have proposed it to TenPlus1? ;-)
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Feb 03, 2015 03:49

Thanks to a great idea and initial code from TeTpaAka CompassGPS now includes MAPS!
Maps allow you to store a bookmark that you can then give to another player and they can use the map to put that bookmark into their own list. They also enhance role playing/story possibilities since you can hide maps for players to find that will give them bookmarks they need to find their next goal.

Craft a blank map by putting 5 papers in an X pattern:
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
paper,     ,paper
     ,paper,
paper,     ,paper

Image

To place a bookmark into a map, just right click while wielding the map, select any bookmark from your list, and click the "write to cgpsmap" button
The map icon now changes to have a red X on it, so you can tell it is a marked map. This map can be given to another player. To transfer the bookmark to their own compassgps, they right click while wielding the marked map and a formspec like this pops up:
Image
You can change the name of the bookmark to whatever you wish, click the "copy bookmark to your compassgps" button and the new bookmark is now available in your compassgps list.

To turn a marked map back into a blank map, just put it into the crafting grid.

I would appreciate anyone who could help test this new code, and if you run into any bugs, please report back here!

If you like the new map additions, please leave a postive comment for TeTpaAka, because this is another great idea of his, and is mostly his code.

You can download the new version of compassGPS with the maps included here:

https://github.com/Kilarin/compassgps/a ... master.zip
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Feb 03, 2015 03:51

peprim wrote:I would like so much can use it in Xanadu... Maybe you already have proposed it to TenPlus1? ;-)

Glad you like the mod pepprim. If you want it in Xanadu, talk to TenPlus1 about it. BUT, he has worked VERY hard to optimize Xanadu for very little lag, and I am not at all certain what kind of load compassgps adds to a server.
 

User avatar
Napiophelios
Member
 
Posts: 752
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [Mod] Compass GPS [compassgps]

by Napiophelios » Tue Feb 03, 2015 11:29

What a perfect crafting recipe.
"X" marks the spot...I love it.
 

User avatar
cHyper
Member
 
Posts: 587
Joined: Fri May 06, 2011 08:49
IRC: cHyper
In-game: cHyper

Re: [Mod] Compass GPS [compassgps]

by cHyper » Tue Feb 03, 2015 12:51

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
ACTION[ServerThread]: singleplayer uses compassgps:cgpsmap, pointing at [node under=49,2,25 above=49,3,25]
13:48:26: WARNING: Undeclared global variable "start_i" accessed at ...\..\games\cHyper\mods\craftingpack\crafting/creative.lua:296
13:48:29: ACTION[ServerThread]: singleplayer uses compassgps:cgpsmap_marked, pointing at [node under=49,2,25 above=49,3,25]
13:48:29: ERROR[main]: ServerError: ... (32bit)\bin\..\games\cHyper\mods\compassgps/cgpsmap.lua:29: attempt to index local 'meta' (a nil value)
13:48:29: ERROR[main]: stack traceback:
13:48:29: ERROR[main]:    ... (32bit)\bin\..\games\cHyper\mods\compassgps/cgpsmap.lua:29: in function 'read_from_cgpsmap'
13:48:29: ERROR[main]:    ... (32bit)\bin\..\games\cHyper\mods\compassgps/cgpsmap.lua:75: in function <... (32bit)\bin\..\games\cHyper\mods\compassgps/cgpsmap.lua:73>
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Feb 03, 2015 12:56

Yikes! thanks for the report cHyper, can you give me any more details on what you were doing when you got the crash?
 

Xanthin
Member
 
Posts: 121
Joined: Fri Mar 07, 2014 14:05
GitHub: Xanthin
IRC: Xanthin
In-game: Xanthin

Re: [Mod] Compass GPS [compassgps]

by Xanthin » Tue Feb 03, 2015 13:09

I get a similar error when taking the marked map (compassgps:cgpsmap_marked) out of the creative inventory and using it. (nothing that will be intendet for the usual use of this handy mod :D)
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
14:01:48: ERROR[main]: ServerError: ...minetest-0.4.11-win32\bin\..\mods\compassgps/cgpsmap.lua:29: attempt to index local 'meta' (a nil value)
14:01:48: ERROR[main]: stack traceback:
14:01:48: ERROR[main]:    ...minetest-0.4.11-win32\bin\..\mods\compassgps/cgpsmap.lua:29: in function 'read_from_cgpsmap'
14:01:48: ERROR[main]:    ...minetest-0.4.11-win32\bin\..\mods\compassgps/cgpsmap.lua:75: in function <...minetest-0.4.11-win32\bin\..\mods\compassgps/cgpsmap.lua:73>


PS: By the way, I totaly agree with pepprim and hope it will turns out, that the performance impact is low. Would be a great addition to a game world that aims for exploring the map with all its diverse biomes and geological formations.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Feb 03, 2015 13:25

Xanthin wrote:I get a similar error when taking the marked map (compassgps:cgpsmap_marked) out of the creative inventory and using it. (nothing that will be intendet for the usual use of this handy mod :D)

Oh, of course! I never even thought of testing that. DUH! got to build in a defense so marked maps created by /giveme or creative don't cause a crash since they don't actually have a bookmark.

chyper, is that the same situation that caused your crash?
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Feb 03, 2015 13:50

Corrected! (I hope) please test the new version. cgpsmap_marked is no longer in the creative inventory. and if you use /giveme to get one, it defaults to default, so no crash when you use it.
https://github.com/Kilarin/compassgps/archive/master.zip
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Compass GPS [compassgps]

by Miner59 » Tue Feb 03, 2015 16:04

Hi,
I like this mod very much and maps are a nice addition.

Here is a little modification, so that you can save your current position on a map. Although I added a check if point_to[playername] is nil.
If you save your current position on a map, the map is named "(playername)'s map".

I would be happy if you can add this to compassgps mod :-)

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

--*********************************************************
--mode "L" create list for displaying bookmarks in gui
--mode "C" display private bookmarks only in chat
--mode "M" similar to "L" but with current position (for maps)
function compassgps.bookmark_loop(mode,playername,findidx)
  --print("bookmark_loop top")
  local player = minetest.get_player_by_name(playername)
  local playerpos = player:getpos()
  local list=""
  local bkmrkidx=1
  local i=1
  if mode=="L" or mode=="M" then
    local spawnbkmrk=compassgps.get_default_bookmark(playername)
    textlist_bkmrks[playername]={}
    if mode=="M" then
      local cpos=compassgps.round_pos(playerpos)
      list = "current position : "..compassgps.pos_to_string({x=cpos.x,y=cpos.y,z=cpos.z,player=playername,type="P",bkmrkname=playername.."'s map"})..","..
      compassgps.bookmark_name_pos_dist(spawnbkmrk,playername,playerpos)
      textlist_bkmrks[playername][1]={x=cpos.x,y=cpos.y,z=cpos.z,player=playername,type="P",bkmrkname=playername.."'s map"}
      textlist_bkmrks[playername][2]=spawnbkmrk
      i=2
      mode="L"
    else
    list = compassgps.bookmark_name_pos_dist(spawnbkmrk,playername,playerpos)
      textlist_bkmrks[playername][1]=spawnbkmrk
  end --initialize list
    textlist_clicked[playername]=1
end
  --bkmrkidx will be used to highlight the currently selected item in the list
  backwardscompatsave="NO"

  for k,v in spairs(bookmarks,sort_function[playername],player) do
    --backwards compatibility
    --since version 1.5, all bookmarks will have a player and type, but
    --bookmarks from the old compass mods and previous versions of this
    --mod will not.  Because the original mod did not put a seperator between
    --the playername and the bookmark name, the only way to seperate them
    --is when you have the player name.  this if says that if v.player is
    --not defined and the begining of the bookmark matches the playername
    --then set v.player and v.type and set a flag to save the bookmarks
    --print("bookmark_loop unmod "..compassgps.bookmark_to_string(v))
    if not v.player then --if playername is not set, fix it
        local pos1, pos2 = string.find(k, playername, 0)
      if pos1==1 and pos2 then --add playername and type to bookmark
        v.player=playername
        v.type="P"
        v.bkmrkname=string.sub(k,string.len(v.player)+1)
        backwardscompatsave="YES"
      end --if pos1==1
    end --if not v.player backwards compatibility

    --even though we set v.player above, that was for bookmarks that match
    --this playername, so there could still be other players bookmarks that
    --do not have v.player defined, thats why we have to check it again.
    local vplayernm=""
    if v.player then vplayernm=v.player end
    local vtype="P"
    if v.type then vtype=v.type end
    local vbkmrkname=k
    if v.bkmrkname then vbkmrkname=v.bkmrkname end
    --now vplayernm,vtype,vbkmrkname are guaranteed to be defined

    --admin and shared bookmarks
    if (mode=="L") and
       ( (vtype=="A" and view_type_A[playername]=="true") or
         (vtype=="S" and view_type_S[playername]=="true") ) then
      i=i+1
      list = list..","..compassgps.bookmark_name_pos_dist(v,playername,playerpos)
      textlist_bkmrks[playername][i]=v
      --print("bookmark_loop AS "..i.." "..compassgps.bookmark_to_string(textlist_bkmrks[playername][i]))
    --private bookmarks
    elseif vtype=="P" and vplayernm==playername and view_type_P[playername]=="true" then
      i=i+1
      if mode=="L" then
        list = list..","..compassgps.bookmark_name_pos_dist(v,playername,playerpos)
           --list = list..","..vbkmrkname.." : "..compassgps.pos_to_string(v)..
        --  " : "..compassgps.round_digits(distance_function[playername](playerpos,v),2)
        textlist_bkmrks[playername][i]=v
        --print("bookmark_loop P "..i.." "..compassgps.bookmark_to_string(textlist_bkmrks[playername][i]))
      elseif mode=="C" then
        --minetest.chat_send_player(playername, vbkmrkname..": "..compassgps.pos_to_string(v))
        minetest.chat_send_player(playername, compassgps.bookmark_name_pos_dist(v,playername,playerpos))
      end
      end --if vtype

    --print("bookmark_loop mode="..mode.." bkmrkidx="..bkmrkidx.." vbkmkrname="..vbkmrkname.." point_to="..point_to[playername].bkmrkname.." vplayer="..vplayer.." point_to="..point_to[playername].player)
     --set testlist_clicked to the currently selected item in the list
    if point_to[playername]~=nil then -- don't crash when point_to[playername] is nil
    if mode=="L" and bkmrkidx==1 and vbkmrkname==point_to[playername].bkmrkname
        and vplayernm==point_to[playername].player then
      bkmrkidx=i
      textlist_clicked[playername]=i
      --point_to is the bookmark this player's compass is already pointing to
      --when we open the list, if we found a bookmark that matches that item, we want
      --to highlight it (by setting bkmrkidx to the index to highlight) and we want
      --to set textlist_clicked to match that item.  We need textlist_clicked because
      --textlist does not return the currently selected item when you click a button,
      --so we must keep the currently selected item in memory
    --elseif mode=="I" and i==findidx then
    --  return bkmrkname --found the item we were looking for, we are done.
    end --if mode=L
   end --for spairs
   end

  if backwardscompatsave=="YES" then compassgps.write_bookmarks() end

  if mode=="L" then
    return list,bkmrkidx
  --elseif mode=="I" then
  --  return "default" --didn't find it, so return default.
   end --if mode=="L"

end --bookmark_loop




and one little change in 8. line of cgpsmap.lua:

local list,bkmrkidx=compassgps.bookmark_loop("M", user:get_player_name())

instead of:

local list,bkmrkidx=compassgps.bookmark_loop("L", user:get_player_name())
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Feb 03, 2015 19:18

Napiophelios wrote:What a perfect crafting recipe. "X" marks the spot...I love it.

yep. EXCEPT, since maps can't stack, I can't give you more than one of them, so 5 paper for one map is a little bit expensive. But since paper isn't really all that expensive, I'm not certain this is a problem.

Miner59 wrote:Here is a little modification, so that you can save your current position on a map.

Excellent idea! I'll see if I can integrate it tonight.

The next thing I'd like to look at doing with this is allowing marked maps to be wall mounted. A map that you can give to someone is great, but a map that could be mounted like a sign and protected so that multiple players could use it, but no one could take it, would be useful in some circumstances I think. Such as putting a wall of maps near spawn so that users can click on them and add a bookmark to the store/location they want to go to and then follow their compass there. With a wall mounted map you would just punch it to bring up the formspec.

BUT, such a change would be best if I could use some logic from the sign mod that Xanadu uses so that the name of the bookmark could actually appear on the wall mounted map. No clue how that works, will have to do some research.
 

User avatar
cHyper
Member
 
Posts: 587
Joined: Fri May 06, 2011 08:49
IRC: cHyper
In-game: cHyper

Re: [Mod] Compass GPS [compassgps]

by cHyper » Tue Feb 03, 2015 21:29

Kilarin wrote:chyper, is that the same situation that caused your crash?


same situation...
 

User avatar
cHyper
Member
 
Posts: 587
Joined: Fri May 06, 2011 08:49
IRC: cHyper
In-game: cHyper

Re: [Mod] Compass GPS [compassgps]

by cHyper » Tue Feb 03, 2015 21:52

Miner59 wrote:I would be happy if you can add this to compassgps mod


+1 good work, any error?
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Wed Feb 04, 2015 03:21

cHyper wrote:+1 good work, any error?

Indeed! And none that I found.

Version 2.2 with current position option for maps is available for download!

https://github.com/Kilarin/compassgps/archive/master.zip

Thank you very much Miner95!
 

User avatar
cHyper
Member
 
Posts: 587
Joined: Fri May 06, 2011 08:49
IRC: cHyper
In-game: cHyper

Re: [Mod] Compass GPS [compassgps]

by cHyper » Wed Feb 04, 2015 12:24

+1 perfect...
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Compass GPS [compassgps]

by TeTpaAka » Mon Feb 16, 2015 14:09

I added another Pull-Request on GitHub. I made the mod translatable with intllib.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Wed Feb 18, 2015 03:13

EXCELLENT! Thank you very much for all that work! Now Compass GPS will work with german!

pull merged and available for download on github. https://github.com/Kilarin/compassgps/archive/master.zip

If anyone is interested in adding translations for any other languages I'd be happy for more pull requests. :)
 

Miner59
Member
 
Posts: 46
Joined: Mon Sep 22, 2014 19:14

Re: [Mod] Compass GPS [compassgps]

by Miner59 » Wed Feb 18, 2015 13:16

Hi,
found a bug. There were variables with "name" instead of "playername" in a function, in init.lua, line 790.
Here is corrected version:

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 compassgps.find_bookmark_byname(playername, bkmrkname)
local player = minetest.get_player_by_name(playername)
if not player then
return
end
if not bkmrkname or bkmrkname == "" then
minetest.chat_send_player(playername, S("No bookmark was specified."))
return
end
if bkmrkname == "default" then
minetest.chat_send_player(playername, S("Pointing at default location."))
point_to[playername] = compassgps.get_default_bookmark(playername)
return
end
if not bookmarks[playername..bkmrkname] then
minetest.chat_send_player(playername, S("You have no bookmark with this name."))
return
end
point_to[playername] = bookmarks[playername..bkmrkname]
minetest.chat_send_player(playername, S("Pointing at %s."):format(bkmrkname))
end


Ok, very good work, thanks.
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Thu Feb 19, 2015 04:06

Correction made. And thank you VERY much, that was an OLD error!
Version 2.3 with bugfix available on github: https://github.com/Kilarin/compassgps/archive/master.zip
 

Kilarin
Member
 
Posts: 649
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Tue Mar 03, 2015 23:24

I just merged a pull request from Miner59:
Miner59 wrote:Since BlockMen recently added his beds mod to default minetest game I added code to read the saved positions from this mod, too.
Although I made some other small improvements.


Thank you VERY much!
https://github.com/Kilarin/compassgps/archive/master.zip
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 46 guests

cron