TeTpaAka wrote:Maybe you could add the compass to the HUD and disable the constant replacement of the compass in the inventory.
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.
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:
paper, ,paper
,paper,
paper, ,paper
peprim wrote:I would like so much can use it in Xanadu... Maybe you already have proposed it to TenPlus1? ;-)
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>
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>
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)
--*********************************************************
--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
Napiophelios wrote:What a perfect crafting recipe. "X" marks the spot...I love it.
Miner59 wrote:Here is a little modification, so that you can save your current position on a map.
Kilarin wrote:chyper, is that the same situation that caused your crash?
Miner59 wrote:I would be happy if you can add this to compassgps mod
cHyper wrote:+1 good work, any error?
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
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.
Users browsing this forum: No registered users and 46 guests