[Mod] Compass GPS [compassgps]

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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: 126
Joined: Fri Mar 07, 2014 14:05
GitHub: Xanthin
IRC: Xanthin
In-game: Xanthin
Location: Germany

Re: [Mod] Compass GPS [compassgps]

by Xanthin » Post

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)

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.

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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?

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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/a ... master.zip

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

Re: [Mod] Compass GPS [compassgps]

by Miner59 » Post

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 :-)

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())

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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: 904
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper cHyper_de
In-game: cHyper cHyper_0815
Location: Austria
Contact:

Re: [Mod] Compass GPS [compassgps]

by cHyper » Post

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

User avatar
cHyper
Member
Posts: 904
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper cHyper_de
In-game: cHyper cHyper_0815
Location: Austria
Contact:

Re: [Mod] Compass GPS [compassgps]

by cHyper » Post

Miner59 wrote: I would be happy if you can add this to compassgps mod
+1 good work, any error?

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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/a ... master.zip

Thank you very much Miner95!

User avatar
cHyper
Member
Posts: 904
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper cHyper_de
In-game: cHyper cHyper_0815
Location: Austria
Contact:

Re: [Mod] Compass GPS [compassgps]

by cHyper » Post

+1 perfect...

User avatar
TeTpaAka
Member
Posts: 141
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Compass GPS [compassgps]

by TeTpaAka » Post

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

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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/a ... 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 » Post

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

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.

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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/a ... master.zip

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

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/a ... master.zip

User avatar
DevilRomeoAPLUS
Member
Posts: 38
Joined: Sun Dec 14, 2014 10:53
In-game: DevilRomeo2
Location: Malaysia
Contact:

Re: [Mod] Compass GPS [compassgps]

by DevilRomeoAPLUS » Post

Fix it

Irrlicht log: Irrlicht Engine version 1.8.1
Irrlicht log: Microsoft Windows 7 Ultimate Edition Service Pack 1 (Build 7601)
Irrlicht log: Using renderer: OpenGL 2.0.0
Irrlicht log: Intel 965/963 Graphics Media Accelerator: Intel
Irrlicht log: OpenGL driver version is 1.2 or better.
Irrlicht log: GLSL version: 1.1
Irrlicht log: Resizing window (800 600)
10:26:20: ACTION[main]: WARNING: Mod name conflict detected: "farming"
10:26:20: ACTION[main]: Will not load: E:\minetest-0.4.10-win32\bin\..\games\minetest_game\mods\farming
10:26:20: ACTION[main]: Overridden by: E:\minetest-0.4.10-win32\bin\..\mods\farming
10:26:21: ERROR[main]: Error loading mod "compassgps-master": modname does not follow naming conventions: Only chararacters [a-z0-9_] are allowed.
10:26:21: ERROR[main]: Server: Failed to load and run E:\minetest-0.4.10-win32\bin\..\mods\compassgps-master\init.lua
10:26:21: ERROR[main]: ModError: ModError: Failed to load and run E:\minetest-0.4.10-win32\bin\..\mods\compassgps-master\init.lua
Bananana Banananana *Nom*

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

Re: [Mod] Compass GPS [compassgps]

by Napiophelios » Post

DevilRomeoAPLUS wrote:Fix it

10:26:21: ERROR[main]: ModError: ModError: Failed to load and run E:\minetest-0.4.10-win32\bin\..\mods\compassgps-master\init.lua
Naming conventions – read this if “mod doesn't work”

User avatar
DevilRomeoAPLUS
Member
Posts: 38
Joined: Sun Dec 14, 2014 10:53
In-game: DevilRomeo2
Location: Malaysia
Contact:

Re: [Mod] Compass GPS [compassgps]

by DevilRomeoAPLUS » Post

O.O Oh thanks lol
Bananana Banananana *Nom*

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

Nathan Salapat has done a nice youtube review of CompassGPS:
https://www.youtube.com/watch?v=ow4qGGiYN3s

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

Re: [Mod] Compass GPS [compassgps]

by 12Me21 » Post

Here are some of my suggestions:
Better texture:
-As someone else said, the default texture is the same as the watch mod
-It's also not very good to begin with, as it uses anti-aliasing, which is never a good thing to do in small textures.
-The other texture is nice, but it is just a larger image that has been scaled down. This is a really lazy thing to do (for something this simple), and looks really bad (compared to actually making a new texture). It also has a higher resolution texture, which is really not necessary, and looks really bad and out of place.

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

12Me21 wrote:The other texture is nice, but it is just a larger image that has been scaled down. This is a really lazy thing to do (for something this simple), and looks really bad (compared to actually making a new texture). It also has a higher resolution texture, which is really not necessary, and looks really bad and out of place.
I have to disagree with you on both. I think the texture by Bas080 looks fine, and I like the high resolution texture by Andre Goble quite a bit.
But then, the whole point of having multiple textures to choose from is to provide choice for people with different opinions. Please feel free to design a texture that you prefer, code it, and give me a pull request. More textures introduce negligible overhead while providing users with more choices, which is always good in my opinion.

Bas080 (slight modifications by Kilarin)
compass c textures: CC BY-SA by Andre Goble

User avatar
12Me21
Member
Posts: 873
Joined: Tue Mar 05, 2013 00:36
GitHub: 12Me21
Location: (Ignore all of my posts before 2018)

Re: [Mod] Compass GPS [compassgps]

by 12Me21 » Post

Kilarin wrote:
12Me21 wrote:The other texture is nice, but it is just a larger image that has been scaled down. This is a really lazy thing to do (for something this simple), and looks really bad (compared to actually making a new texture). It also has a higher resolution texture, which is really not necessary, and looks really bad and out of place.
I have to disagree with you on both. I think the texture by Bas080 looks fine, and I like the high resolution texture by Andre Goble quite a bit.
But then, the whole point of having multiple textures to choose from is to provide choice for people with different opinions. Please feel free to design a texture that you prefer, code it, and give me a pull request. More textures introduce negligible overhead while providing users with more choices, which is always good in my opinion.

Bas080 (slight modifications by Kilarin)
compass c textures: CC BY-SA by Andre Goble
I think the alternate 16x16 texture is nice, but the others both use a lot of anti-aliasing, which is not really good in smaller textures. other than that, this is a pretty nice mod.

User avatar
SpaghettiToastBook
Member
Posts: 52
Joined: Sun Feb 22, 2015 21:11
In-game: STB
Location: The Milky Way

Re: [Mod] Compass GPS [compassgps]

by SpaghettiToastBook » Post

I'd love it if the maps could be placed on walls and read from walls as well.

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

SpaghettiToastBook wrote:I'd love it if the maps could be placed on walls and read from walls as well.
I thought the same thing while I was playing with the maps. Just haven't implemented it yet.
Wall mounted maps would have the added advantage of letting you put up maps that anyone could use to add a bookmark to their compassGPS but that no one could TAKE, so they would be there for the next player.

User avatar
Kilarin
Member
Posts: 779
Joined: Mon Mar 10, 2014 00:36

Re: [Mod] Compass GPS [compassgps]

by Kilarin » Post

I just accepted a pull request from Miner59. He added wall mounted maps!!!!
https://github.com/Kilarin/compassgps/a ... master.zip

BUT, he added one feature that while I think it is INCREDIBLY cool, I'm not certain if its practical. The maps get bigger as they mark an area further away from the current location. I didn't even know this was possible, its some incredibly clever code that places the map as an entity (like item frame does). Here is a screenshot with some maps of various ranges from 50 nodes away to 60,000 nodes away
Image
I should have looked at the distances in the code and picked the ranges a bit better, but this does give you the general idea.

Like I said, I think this is incredibly cool, but I'm picturing trying to put a map on a wall in a castle or at spawn and having a very difficult time fitting it in. :)

What do you folks think, should we keep the interesting increasing map size, or modify it to be more boring but practical?

And Miner59, THANK YOU, whether we keep the increasing map size or not, it was some incredibly clever code that taught me tricks I did not know. And having wall mounted maps is GREAT!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 8 guests