Removed compassgps

- Solves #185
This commit is contained in:
LeMagnesium 2015-08-04 16:17:53 +02:00
parent 388a29ef49
commit 7f6d82a4c3
47 changed files with 0 additions and 2092 deletions

View File

@ -1,158 +0,0 @@
This mod creates a customizable compass with user settable bookmarks and shared and admin bookmarks in multiplayer.
**Compass GPS version 2.6**
Echo created a compass mod back in 2012: [https://forum.minetest.net/viewtopic.php?id=3785](https://forum.minetest.net/viewtopic.php?id=3785)<p>
PilzAdams made a modification of it, which I can not find the source to, I don't know how much of PilzAdams changes made it into the later versions of Echo's mod.<p>
Then in 2013 TeTpaAka made a fork of the compass mod that he called compass+ [https://forum.minetest.net/viewtopic.php?id=8117](https://forum.minetest.net/viewtopic.php?id=8117)<p>
This fork added the ability to "bookmark" specific places, and a gui so you could choose what point the compass should point to.
This is my fork of TeTpaAka's fork of Echo's mod. :)
The compass mod as it was is REALLY cool I love the way Echo managed to make the compass in your inventory actually change it's image to point in the direction of it's target
![alt text](http://i59.tinypic.com/a15ls0.png "image")
And TeTpaAka's gui, file io, and coding for multiplayer games was simply amazing. But as I was learning from their awesome code, I saw some changes I'd like to make using these new ideas, as well as some things I learned while looking at other mods. So, with complete and total respect for the original awesome mods, and hopefully in the same spirit as theirs, I present my own fork of the fork. CompassGPS
The crafting recipe for a compass is unchanged:<p>
```
, steel ,
steel, mese fragment, steel
, steel ,
```
![alt text](http://i59.tinypic.com/14ad2qw.png "image")
Compass GPS introduces several other changes though. First of all, this mod adds a heads up display that indicates your current position, and the name of the bookmark the compass is pointing at, that bookmarks pos, as well as the distance to that bookmark.
![alt text](http://i60.tinypic.com/facwea.png "image")
The hud updates constantly as long as the compass is in one of your active inventory slots, so you can always know where you are in relation to the target node, and how far away it is.
There is a GUI that pops up whenever you wield the compass and left click. I never played with a GUI in minetest before, so this was a new experience for me, I learned a lot and made quite a few changes:
![alt text](http://i61.tinypic.com/29zzgy1.png "image")
To create a new bookmark, type the name into the "bookmark:" field and click "Create Bookmark" (or just hit enter). To remove a bookmark, select it from the list and click "Remove Bookmark." A confirmation dialog will appear and the bookmark will only be removed if you click "YES".
The bookmark list has been expanded from a dropdown into a textlist to improve visibility. Select any bookmark in the list by clicking on it, and then click "Find Selected Bookmark" to make the compass (and hud) point at that location. "default" is always at the top of the list and will point to (0,0,0) or your bed from PilzAdams bed-mod, or home location as defined in the sethome-mod. (Setting default to your bed or sethome is old code, I modified it to make it work with my new version, but I cant take credit for the idea or basic structure.) The rest of the list are bookmarked locations that you have set and named
Just click in the "Sort by" box to change whether the bookmarks are sorted by name, or by distance from your current location. ("default" will still always be the first item in the list no matter which way you sort it)
Click in the "Dist" box to change whether the distance is calculated in 3d (including your distance in the vertical direction) or in 2d (x and z coords only, ignore vertical distance)
Down at the lower right of the screen, I'm certain you noticed the "Teleport to bookmark" button. *That button appears if, and ONLY IF the player has teleport privileges.* If they do, then they can select any bookmark out of the list, click on teleport, and be instantly transported to the location of that bookmark. Since the user already had teleport privileges, this just saved them some typing, it's not adding any new abilities.
If you click the "Settings" button in the upper right hand corner it brings up a screen where you can customize the appearance of your compass gps:
![alt text](http://i59.tinypic.com/aahqa8.png "image")<p>
(The two awesome new compass images are by Bas080 and Spootonium)
I figured the position of the hud text was likely to be something that people would want to customize, so here in the settings gui are the x and y coords for the hud text. Just enter the new coords where you want the hud text to appear and click "Change Hud"<p>
The cords must be between 0 and 1 and represent a percentage of the screen, so x=0 would put the text at the far left of the screen, and y=0.98 would put the text almost at the bottom of the screen. The default is x=0.4 and y=0.01, and that is displayed right over the input boxes so the user can easily set them back to the default if they are having trouble placing the hud. If you change either the x or y coord to a number that is out of range (less than 0 or greater than 1) then the hud will not be displayed. That makes it easy to turn the hud off if you wish.<p>
You can also change the color of the hud text by changing the value in the "Color" field here. Again, click "Change Hud" to make the update appear.
AND, there are three buttons here that allow you to select from 3 different styles of compass images. The basic compass image by Echo. A nice wooden compass image by Bas080. And a high resolution compass image by spootonium.
In Multiplayer, there are now shared and admin bookmarks!<p>
![alt text](http://i61.tinypic.com/a5b7li.png "image")<p>
If a player has the new "shared_bookmarks" privilege, then they will get the "Create Shared Bookmark" button and be able to create bookmarks that all players on the server can see and use. Shared bookmarks are preceded by *shared* and the name of the player that created them. There is a variable near the top of the init.lua called max_shared. This controls the maximum number of shared bookmarks that an individual player can create. It is set to 10 by default, but the server admin can change it to whatever they want. A player can delete their own shared bookmarks, but they can not delete anyone else's (unless they are an admin, then they can delete anyone's shared bookmarks)
If a player has the "privs" privilege, then they will get the "Create Admin Bookmark" button. Admin bookmarks are intended to allow the admins to mark important places in their world that they want everyone to be able to find. There are no limits on how many admin bookmarks can be created. Only Admins can delete admin bookmarks.
In a multiplayer game, all players get the "Show: Private, Shared, Admin" checkboxes. You can use these checkboxes to toggle which type of bookmarks show in your list. If you uncheck all three the system will automatically recheck "Private" for you.
The bookmark list is saved any time a user changes it. All of your other settings, the currently selected bookmark, sort order, distance function, and hud position and color, and compass type, are saved whenever a user leaves the game, and on game shutdown. So if you move the hud down to the lower right hand corner of the screen, and then quit, the hud will still be in the place you put it when you restart the game later.
The Chat Commands from the orignal compass mod still work, but only on private bookmarks. Chat commands available are:<p>
list_bookmarks<p>
set_bookmark <bookmark name><p>
find_bookmark <bookmark name><p>
remove_bookmark <bookmark name>
I also fixed a few bugs while I was working on this. There was a problem in the mod that caused compass to jump around in inventory if there were empty slots above it, that is fixed now. And there was also a problem with the bookmark list not being saved after you removed a bookmark if you didn't add a new bookmark afterwards. Now the bookmark list is saved whenever you change it, either adding or removing.
I tried to follow Echo and TeTpaAka's examples of how to properly code for multiplayer games, and all of the new settings should work just fine in a multiplayer game.
----** MAPS! **----
Thanks to a great idea and initial code from TeTpaAka CompassGPS now includes MAPS!<p>
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:<p>
```
paper, ,paper
,paper,
paper, ,paper
```
![alt text](http://i57.tinypic.com/20z5wmr.png "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. You can also put your current position into the map (without having to first create a bookmark in your compassGPS)
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:<p>
![alt text](http://i61.tinypic.com/jakj9v.png "image")<p>
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.
Thanks to some nice code by Miner59 you can now mount a map on a wall! If you can dig on the position where the map is placed, you can take the map, otherwise you can add the bookmark saved in the map in your compassgps. This will make it possible on a multiplayer server to mount maps that everyone can use.
---------------------
The code is kinda a mess, because I was learning a lot of new things while working on it. I hope to do a clean up on it sometime in the near future, but I wanted to release it now so some people could start testing it. Please do not hesitate to offer critiques, criticism, or coding advice. I'm new to lua and minetest and could use the help.
And above all, if you run into a bug, please let me know!
**Credits:**<p>
Original mod is by Echo and TeTpaAka, and probably PilzAdam. Cactuz_pl clockmod showed me how to write the hud to the screen. My son offered a lot of advice and suggested several changes. I got an example of how to sort lists in lua from Michal Kottman on StackOverflow. Big thanks to Bas080 and spootonium for providing some very nice alternate images for the compass gps mod! Also thanks to Topywo for the shared bookmarks idea, and to my son for several ideas, corrections, and testing help.<p>
Map idea, image, and initial code by TeTpaAka. Store current position in map code contributed by Miner95<p>
intllib support by TeTpaAka<p>
Wall mounted maps by Miner59
**License:**<p>
Original code by Echo, PilzAdam, and TeTpaAka is WTFPL. My changes are CC0 (No rights reserved)<p>
textures: original compass textures: CC BY-SA by Echo<p>
compass b textures: CC BY-SA by Bas080 (slight modifications by Kilarin)<p>
compass c textures: CC BY-SA by Andre Goble mailto:spootonium@gmail.com<p>
(slight modifications by Kilarin)<p>
map texture: CC BY-SA by TeTpaAka (slight modifications by Kilarin for blank map)
**Dependencies:**<p>
default is the only requirement.<p>
PilzAdams Beds mod and the sethome-mod are supported if you have them.
**Incompatibilities:**<p>
This mod will clash with both the original compass and compass+ mods. They should not be installed and enabled at the same time as compassgps. HOWEVER, compassgps is 100% compatible with the bookmarks file from the compass+ mod. So if you were using compass+ and switch to compassgps you will NOT lose your previous bookmarks.
**github source:**<p>
[https://github.com/Kilarin/compassgps](https://github.com/Kilarin/compassgps)
**Download:**<p>
[https://github.com/Kilarin/compassgps/archive/master.zip](https://github.com/Kilarin/compassgps/archive/master.zip)
**To install:**<p>
Simply unzip the file into your mods folder, then rename the resulting folder from compassgps-master to compassgps<p>
OR, simply install it directly from minetest using the online mod repository.
**Mod Database:**<p>
If you use this mod, please consider reviewing it on the MineTest Mod Database.<p>
[https://forum.minetest.net/mmdb/mod/compassgps/](https://forum.minetest.net/mmdb/mod/compassgps/)
**Changelog:**<p>
2.6 bug fix from myoung008, type causing crashes when entering bad color.<p>
2.5 bug fix from TeTpaAka fix bug when static_spawnpoint is invalid<p>
2.4 wall mounted maps by Miner59<p>
2.3 intllib support by TeTpaTka so CompassGPS will work with different languages now!<p>
2.2 current position option in bookmark list when writing to map (Miner95 contribution)<p>
2.1 cgpsmap_marked notincreative and defaults to default on /giveme<p>
2.0 maps so you can exchange bookmarks between players (TeTpaAka initial contribution)<p>
1.9 corrected undeclared global variables to avoid warnings.<p>
1.8 changed register_craft to compassgps:0 for unified inventory compatibility<p>
1.7 fixed bug causing crash on first load of formspec in multiplayer<p>
1.6 fixed compass point_to not saving<p>
1.5 shared/admin bookmarks. confirm dialog for remove.<p>
1.4 corrected teleport button priv<p>
1.3 multiple compass types<p>
1.2 rounding of position corrected<p>
1.1 switched core to minetest<p>
1.0 Initial release<p>

View File

@ -1,157 +0,0 @@
[b]Compass GPS version 2.6[/b]
This mod creates a customizable compass with user settable bookmarks and shared and admin bookmarks in multiplayer.
Echo created a compass mod back in 2012: [url]https://forum.minetest.net/viewtopic.php?id=3785[/url]
PilzAdams made a modification of it, which I can not find the source to, I don't know how much of PilzAdams changes made it into the later versions of Echo's mod.
Then in 2013 TeTpaAka made a fork of the compass mod that he called compass+ [url]https://forum.minetest.net/viewtopic.php?id=8117[/url]
This fork added the ability to "bookmark" specific places, and a gui so you could choose what point the compass should point to.
This is my fork of TeTpaAka's fork of Echo's mod. :)
The compass mod as it was is REALLY cool I love the way Echo managed to make the compass in your inventory actually change it's image to point in the direction of it's target
[img]http://i59.tinypic.com/a15ls0.png[/img]
And TeTpaAka's gui, file io, and coding for multiplayer games was simply amazing. But as I was learning from their awesome code, I saw some changes I'd like to make using these new ideas, as well as some things I learned while looking at other mods. So, with complete and total respect for the original awesome mods, and hopefully in the same spirit as theirs, I present my own fork of the fork. CompassGPS
The crafting recipe for a compass is unchanged:
[code]
, steel ,
steel, mese fragment, steel
, steel ,
[/code]
[img]http://i59.tinypic.com/14ad2qw.png[/img]
Compass GPS introduces several other changes though. First of all, this mod adds a heads up display that indicates your current position, and the name of the bookmark the compass is pointing at, that bookmarks pos, as well as the distance to that bookmark.
[img]http://i60.tinypic.com/facwea.png[/img]
The hud updates constantly as long as the compass is in one of your active inventory slots, so you can always know where you are in relation to the target node, and how far away it is.
There is a GUI that pops up whenever you wield the compass and left click. I never played with a GUI in minetest before, so this was a new experience for me, I learned a lot and made quite a few changes:
[IMG]http://i61.tinypic.com/29zzgy1.png[/IMG]
To create a new bookmark, type the name into the "bookmark:" field and click "Create Bookmark" (or just hit enter). To remove a bookmark, select it from the list and click "Remove Bookmark." A confirmation dialog will appear and the bookmark will only be removed if you click "YES".
The bookmark list has been expanded from a dropdown into a textlist to improve visibility. Select any bookmark in the list by clicking on it, and then click "Find Selected Bookmark" to make the compass (and hud) point at that location. "default" is always at the top of the list and will point to (0,0,0) or your bed from PilzAdams bed-mod, or home location as defined in the sethome-mod. (Setting default to your bed or sethome is old code, I modified it to make it work with my new version, but I cant take credit for the idea or basic structure.) The rest of the list are bookmarked locations that you have set and named
Just click in the "Sort by" box to change whether the bookmarks are sorted by name, or by distance from your current location. ("default" will still always be the first item in the list no matter which way you sort it)
Click in the "Dist" box to change whether the distance is calculated in 3d (including your distance in the vertical direction) or in 2d (x and z coords only, ignore vertical distance)
Down at the lower right of the screen, I'm certain you noticed the "Teleport to bookmark" button. [i]That button appears if, and ONLY IF the player has teleport privileges.[/i] If they do, then they can select any bookmark out of the list, click on teleport, and be instantly transported to the location of that bookmark. Since the user already had teleport privileges, this just saved them some typing, it's not adding any new abilities.
If you click the "Settings" button in the upper right hand corner it brings up a screen where you can customize the appearance of your compass gps:
[IMG]http://i59.tinypic.com/aahqa8.png[/IMG]
(The two awesome new compass images are by Bas080 and Spootonium)
I figured the position of the hud text was likely to be something that people would want to customize, so here in the settings gui are the x and y coords for the hud text. Just enter the new coords where you want the hud text to appear and click "Change Hud"
The cords must be between 0 and 1 and represent a percentage of the screen, so x=0 would put the text at the far left of the screen, and y=0.98 would put the text almost at the bottom of the screen. The default is x=0.4 and y=0.01, and that is displayed right over the input boxes so the user can easily set them back to the default if they are having trouble placing the hud. If you change either the x or y coord to a number that is out of range (less than 0 or greater than 1) then the hud will not be displayed. That makes it easy to turn the hud off if you wish.
You can also change the color of the hud text by changing the value in the "Color" field here. Again, click "Change Hud" to make the update appear.
AND, there are three buttons here that allow you to select from 3 different styles of compass images. The basic compass image by Echo. A nice wooden compass image by Bas080. And a high resolution compass image by spootonium.
In Multiplayer, there are now shared and admin bookmarks!
[IMG]http://i61.tinypic.com/a5b7li.png[/IMG]
If a player has the new "shared_bookmarks" privilege, then they will get the "Create Shared Bookmark" button and be able to create bookmarks that all players on the server can see and use. Shared bookmarks are preceded by *shared* and the name of the player that created them. There is a variable near the top of the init.lua called max_shared. This controls the maximum number of shared bookmarks that an individual player can create. It is set to 10 by default, but the server admin can change it to whatever they want. A player can delete their own shared bookmarks, but they can not delete anyone else's (unless they are an admin, then they can delete anyone's shared bookmarks)
If a player has the "privs" privilege, then they will get the "Create Admin Bookmark" button. Admin bookmarks are intended to allow the admins to mark important places in their world that they want everyone to be able to find. There are no limits on how many admin bookmarks can be created. Only Admins can delete admin bookmarks.
In a multiplayer game, all players get the "Show: Private, Shared, Admin" checkboxes. You can use these checkboxes to toggle which type of bookmarks show in your list. If you uncheck all three the system will automatically recheck "Private" for you.
The bookmark list is saved any time a user changes it. All of your other settings, the currently selected bookmark, sort order, distance function, and hud position and color, and compass type, are saved whenever a user leaves the game, and on game shutdown. So if you move the hud down to the lower right hand corner of the screen, and then quit, the hud will still be in the place you put it when you restart the game later.
The Chat Commands from the orignal compass mod still work, but only on private bookmarks. Chat commands available are:
list_bookmarks
set_bookmark <bookmark name>
find_bookmark <bookmark name>
remove_bookmark <bookmark name>
I also fixed a few bugs while I was working on this. There was a problem in the mod that caused compass to jump around in inventory if there were empty slots above it, that is fixed now. And there was also a problem with the bookmark list not being saved after you removed a bookmark if you didn't add a new bookmark afterwards. Now the bookmark list is saved whenever you change it, either adding or removing.
I tried to follow Echo and TeTpaAka's examples of how to properly code for multiplayer games, and all of the new settings should work just fine in a multiplayer game.
----[b] MAPS! [/b]----
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:
[code]
paper, ,paper
,paper,
paper, ,paper
[/code]
[img]http://i57.tinypic.com/20z5wmr.png[/img]
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. You can also put your current position into the map (without having to first create a bookmark in your compassGPS)
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:
[img]http://i61.tinypic.com/jakj9v.png[/img]
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.
Thanks to some nice code by Miner59 you can now mount a map on a wall! If you can dig on the position where the map is placed, you can take the map, otherwise you can add the bookmark saved in the map in your compassgps. This will make it possible on a multiplayer server to mount maps that everyone can use.
---------------------
The code is kinda a mess, because I was learning a lot of new things while working on it. I hope to do a clean up on it sometime in the near future, but I wanted to release it now so some people could start testing it. Please do not hesitate to offer critiques, criticism, or coding advice. I'm new to lua and minetest and could use the help.
And above all, if you run into a bug, please let me know!
[b]Credits:[/b]
Original mod is by Echo and TeTpaAka, and probably PilzAdam. Cactuz_pl clockmod showed me how to write the hud to the screen. My son offered a lot of advice and suggested several changes. I got an example of how to sort lists in lua from Michal Kottman on StackOverflow. Big thanks to Bas080 and spootonium for providing some very nice alternate images for the compass gps mod! Also thanks to Topywo for the shared bookmarks idea, and to my son for several ideas, corrections, and testing help.
Map idea, image, and initial code by TeTpaAka. Store current position in map code contributed by Miner95
intllib support by TeTpaAka
Wall mounted maps by Miner59
[b]License:[/b]
Original code by Echo, PilzAdam, and TeTpaAka is WTFPL. My changes are CC0 (No rights reserved)
textures: original compass textures: CC BY-SA by Echo
compass b textures: CC BY-SA by Bas080 (slight modifications by Kilarin)
compass c textures: CC BY-SA by Andre Goble mailto:spootonium@gmail.com
(slight modifications by Kilarin)
map texture: CC BY-SA by TeTpaAka (slight modifications by Kilarin for blank map)
[b]Dependencies:[/b]
default is the only requirement.
PilzAdams Beds mod and the sethome-mod are supported if you have them.
[b]Incompatibilities:[/b]
This mod will clash with both the original compass and compass+ mods. They should not be installed and enabled at the same time as compassgps. HOWEVER, compassgps is 100% compatible with the bookmarks file from the compass+ mod. So if you were using compass+ and switch to compassgps you will NOT lose your previous bookmarks.
[b]github source:[/b]
[url]https://github.com/Kilarin/compassgps[/url]
[b]Download:[/b]
[url]https://github.com/Kilarin/compassgps/archive/master.zip[/url]
[b]To install:[/b]
Simply unzip the file into your mods folder, then rename the resulting folder from compassgps-master to compassgps
OR, simply install it directly from minetest using the online mod repository.
[b]Mod Database:[/b]
If you use this mod, please consider reviewing it on the MineTest Mod Database.
[url]https://forum.minetest.net/mmdb/mod/compassgps/[/url]
[b]Changelog:[/b]
2.6 bug fix from myoung008, type causing crashes when entering bad color.
2.5 bug fix from TeTpaAka fix bug when static_spawnpoint is invalid
2.4 wall mounted maps by Miner59
2.3 intllib support by TeTpaTka so CompassGPS will work with different languages now!
2.2 current position option in bookmark list when writing to map (Miner95 contribution)
2.1 cgpsmap_marked notincreative and defaults to default on /giveme
2.0 maps so you can exchange bookmarks between players (TeTpaAka initial contribution)
1.9 corrected undeclared global variables to avoid warnings.
1.8 changed register_craft to compassgps:0 for unified inventory compatibility
1.7 fixed bug causing crash on first load of formspec in multiplayer
1.6 fixed compass point_to not saving
1.5 shared/admin bookmarks. confirm dialog for remove.
1.4 corrected teleport button priv
1.3 multiple compass types
1.2 rounding of position corrected
1.1 switched core to minetest
1.0 Initial release

View File

@ -1,350 +0,0 @@
--original code for storing bookmarks outside of the compass by TeTpaAka
--modifications by Kilarin and Miner59
--wall mounted maps by Miner59
--set growing_wall_maps to true and wall mounted maps will get bigger the further
--away the target is.
local growing_wall_maps=false
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
S = intllib.Getter(minetest.get_current_modname())
else
S = function ( s ) return s end
end
local selected_cgpsmap = {}
local textlist_bookmark = {}
local selected_bookmark = {}
function write_to_cgpsmap(itemstack, user)
--print("write_to_cgpsmap")
selected_cgpsmap[user:get_player_name()] = itemstack
local list,bkmrkidx=compassgps.bookmark_loop("M", user:get_player_name())
if list == "" then
return nil
end
textlist_bookmark[user:get_player_name()] = list
local formspec = "size[9,10;]"..
"button_exit[2,2;5,0.5;write;"..S("Write to cgpsmap").."]"..
"textlist[0,3.0;9,6;bookmark_list;"..list..";"..bkmrkidx.."]"
minetest.show_formspec(user:get_player_name(), "compassgps:write", formspec)
--print("write_to_cgpsmap end")
end
function read_from_cgpsmap(itemstack, user, meta)
--print("read_from_cgpsmap")
local formspec = "size[9,5]"..
"button_exit[2,3;5,0.5;read;"..S("copy bookmark to your compassgps").."]"
if itemstack~=nil then
formspec=formspec.. "button_exit[3.1,4;2.6,0.8;rename;"..S("rename bookmark").."]"
else
itemstack=ItemStack("compassgps:cgpsmap_marked 1")
if meta then
itemstack:set_metadata(minetest.serialize(meta))
end
end
if not meta then --marked map from creative or /giveme has no meta!
meta={bkmrkname="default",x=0,y=0,z=0}
itemstack:set_metadata(minetest.serialize(meta))
end
selected_cgpsmap[user:get_player_name()] = itemstack
formspec=formspec.."label[2,0.5;"..S("bookmark pos:").." ("..meta["x"]..","..meta["y"]..","..meta["z"]..")]"..
"field[2,2;5,0.5;name;"..S("bookmark name:")..";"..meta["bkmrkname"].."]"
minetest.show_formspec(user:get_player_name(), "compassgps:read", formspec)
--print("read_from_cgpsmap end")
end
minetest.register_craft({
output = 'compassgps:cgpsmap',
recipe = {
{'default:paper', '', 'default:paper'},
{'', 'default:paper', ''},
{'default:paper', '', 'default:paper'}
}
})
minetest.register_craft({
output = 'compassgps:cgpsmap',
recipe = {
{'compassgps:cgpsmap_marked'},
}
})
minetest.register_craftitem("compassgps:cgpsmap", {
description = S("CompassGPS Map (blank)"),
inventory_image = "cgpsmap-blank.png",
--groups = {book = 1},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
write_to_cgpsmap(itemstack, user)
return
end
})
minetest.register_craftitem("compassgps:cgpsmap_marked", {
description = "CompassGPS Map (marked)",
inventory_image = "cgpsmap-marked.png",
groups = {not_in_creative_inventory = 1},
stack_max = 1,
on_use = function(itemstack, user, pointed_thing)
local meta = minetest.deserialize(itemstack:get_metadata())
read_from_cgpsmap(itemstack, user, meta)
return nil
end,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type=="node" and pointed_thing.above then
local pos=pointed_thing.above
local ppos=placer:getpos()
local facedir=minetest.dir_to_facedir(vector.direction(ppos,pointed_thing.under))
local x=pos.x
local y=pos.y
local z=pos.z
if facedir~=nil and itemstack:get_name()=="compassgps:cgpsmap_marked"
and (not minetest.is_protected(pos,placer:get_player_name())) then
minetest.set_node(pos,{name="compassgps:cgpsmap_wall",param2=facedir})
local mapdata = itemstack:get_metadata()
local meta=minetest.get_meta(pos)
meta:set_string("mapdata",mapdata)
if mapdata~=nil then
local data=minetest.deserialize(mapdata)
if data~=nil then
meta:set_string("infotext", data["bkmrkname"])
x=data["x"]
y=data["y"]
z=data["z"]
end
end
if facedir==1 then
pos={x=pos.x+0.3,y=pos.y,z=pos.z}
elseif facedir==3 then
pos={x=pos.x-0.3,y=pos.y,z=pos.z}
elseif facedir==0 then
pos={x=pos.x,y=pos.y,z=pos.z+0.3}
elseif facedir==2 then
pos={x=pos.x,y=pos.y,z=pos.z-0.3}
end
local e = minetest.env:add_entity(pos,"compassgps:cgpsmap_item")
local yaw = math.pi*2 - facedir * math.pi/2
e:setyaw(yaw)
local dist=math.abs(pos.x-x)+math.abs(pos.y-y)+math.abs(pos.z-z)
if growing_wall_maps == false then
e:set_properties({visual_size={x=0.85,y=0.85}})
elseif dist>30000 then
e:set_properties({visual_size={x=3.45,y=3.45}})
elseif dist>15000 then
e:set_properties({visual_size={x=2.95,y=2.95}})
elseif dist>5000 then
e:set_properties({visual_size={x=2.45,y=2.45}})
elseif dist>3000 then
e:set_properties({visual_size={x=1.45,y=1.45}})
elseif dist>2000 then
e:set_properties({visual_size={x=1.2,y=1.2}})
elseif dist>1000 then
e:set_properties({visual_size={x=1,y=1}})
elseif dist>500 then
e:set_properties({visual_size={x=0.85,y=0.85}})
end--else default (0.7)
itemstack:take_item()
end
end
return itemstack
end,
})
minetest.register_node("compassgps:cgpsmap_wall",{
description = "CompassGPS Map (wallmounted)",
drawtype = "nodebox",
node_box = { type = "fixed", fixed = {-0.5, -0.5, 7/16, 0.5, 0.5, 0.5} },
selection_box = { type = "fixed", fixed = {-0.7, -0.7, 7/16, 0.7, 0.7, 0.7} },
tiles = {"compassgps_blank.png"},
inventory_image = "cgpsmap_marked.png",
wield_image = "cgpsmap_marked.png",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = { choppy=2,dig_immediate=2,not_in_creative_inventory=1,not_in_craft_guide=1 },
legacy_wallmounted = true,
sounds = default.node_sound_defaults(),
on_punch = function(pos,node,puncher)
local meta = minetest.env:get_meta(pos)
local mapdata=meta:get_string("mapdata")
if minetest.is_protected(pos,puncher:get_player_name()) then
--don't take map, instead open formspec to add coordinates in compassgps
if mapdata~=nil then
read_from_cgpsmap(nil, puncher, minetest.deserialize(mapdata))
end
return
end
local inv = puncher:get_inventory()
local objs = nil
objs = minetest.env:get_objects_inside_radius(pos, .5)
if objs then
for _, obj in ipairs(objs) do
if obj and obj:get_luaentity() and obj:get_luaentity().name == "compassgps:cgpsmap_item" then
obj:remove()
end
end
end
local itemstack=ItemStack("compassgps:cgpsmap_marked 1")
itemstack:set_metadata(mapdata)
if inv:room_for_item("main",itemstack) then
inv:add_item("main",itemstack)
else
minetest.env:add_item(pos, itemstack)
end
minetest.remove_node(pos)
end,
})
minetest.register_entity("compassgps:cgpsmap_item",{
hp_max = 1,
visual="wielditem",
visual_size={x=0.7,y=0.7},
collisionbox = {0,0,0,0,0,0},
physical=false,
textures={"compassgps:cgpsmap_marked"},
})
minetest.register_abm({
nodenames = { "compassgps:cgpsmap_wall" },
interval = 600,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
if #minetest.get_objects_inside_radius(pos, 0.5) > 0 then return end
local meta=minetest.get_meta(pos)
local x=pos.x
local y=pos.y
local z=pos.z
local mapdata=meta:get_string("mapdata",mapdata)
if mapdata~=nil then
local data=minetest.deserialize(mapdata)
if data~=nil then
x=data["x"]
y=data["y"]
z=data["z"]
end
end
local facedir=node.param2
if facedir==1 then
pos={x=pos.x+0.3,y=pos.y,z=pos.z}
elseif facedir==3 then
pos={x=pos.x-0.3,y=pos.y,z=pos.z}
elseif facedir==0 then
pos={x=pos.x,y=pos.y,z=pos.z+0.3}
elseif facedir==2 then
pos={x=pos.x,y=pos.y,z=pos.z-0.3}
end
local e = minetest.env:add_entity(pos,"compassgps:cgpsmap_item")
local yaw = math.pi*2 - facedir * math.pi/2
e:setyaw(yaw)
local dist=math.abs(pos.x-x)+math.abs(pos.y-y)+math.abs(pos.z-z)
if dist>30000 then
e:set_properties({visual_size={x=3.45,y=3.45}})
elseif dist>15000 then
e:set_properties({visual_size={x=2.95,y=2.95}})
elseif dist>5000 then
e:set_properties({visual_size={x=2.45,y=2.45}})
elseif dist>3000 then
e:set_properties({visual_size={x=1.45,y=1.45}})
elseif dist>2000 then
e:set_properties({visual_size={x=1.2,y=1.2}})
elseif dist>1000 then
e:set_properties({visual_size={x=1,y=1}})
elseif dist>500 then
e:set_properties({visual_size={x=0.85,y=0.85}})
end--else default (0.7)
end
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
if (formname == "compassgps:write") then
if not player then
return
end
local playername = player:get_player_name();
if (playername ~= "") then
if (selected_cgpsmap[playername] == nil) then
return
end
if fields["bookmark_list"] then
-- to get the currently selected
local id = minetest.explode_textlist_event(fields["bookmark_list"])
selected_bookmark[playername] = id.index
end
if fields["write"] then
--print("***cgpsmap fields=write***")
if selected_bookmark[playername] == nil then
return nil
end
local bkmrk=textlist_bkmrks[playername][selected_bookmark[playername]]
local write = { ["bkmrkname"] = bkmrk.bkmrkname,
x = bkmrk.x,
y = bkmrk.y,
z = bkmrk.z}
--print("dump(write)="..dump(write))
selected_cgpsmap[playername]:set_name("compassgps:cgpsmap_marked")
selected_cgpsmap[playername]:set_metadata(minetest.serialize(write))
player:set_wielded_item(selected_cgpsmap[playername])
end
end
end
if (formname == "compassgps:read") then
if not player then
return
end
if (fields["read"]) then
--print("***cgpsmap fields=read***")
local meta = minetest.deserialize(selected_cgpsmap[player:get_player_name()]:get_metadata())
--print("dump(meta)="..dump(meta))
local bkmrkname = fields["name"]
--print("bkmrkname from fields[name]="..bkmrkname)
local pos = { x = meta["x"] + 0,
y = meta["y"] + 0,
z = meta["z"] + 0 }
local playername = player:get_player_name()
--print(bkmrkname)
compassgps.set_bookmark(playername, bkmrkname, "P", pos)
end
end
if (selected_cgpsmap == nil) then
return
end
local playername = player:get_player_name()
if (playername == nil) then
return
end
if (selected_cgpsmap[playername] == nil) then
return
end
if fields["rename"] then
local bkmrkname = fields["name"]
local meta = minetest.deserialize(selected_cgpsmap[player:get_player_name()]:get_metadata())
if meta~=nil and bkmrkname~=nil then
local pos = { x = meta["x"] + 0,
y = meta["y"] + 0,
z = meta["z"] + 0 }
selected_cgpsmap[playername]:set_metadata(minetest.serialize({ ["bkmrkname"] = bkmrkname,
x = pos.x,
y = pos.y,
z = pos.z}))
player:set_wielded_item(selected_cgpsmap[playername]) --new name is saved in marked cpgsmap
end
end
end)

View File

@ -1,2 +0,0 @@
default
intllib?

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +0,0 @@
bkmrkidx\=nil = bkmrkidx\=nil
playername\=%s = playername\=%s
playername\=nil = playername\=nil
%s's map = Karte von %s
A bookmark with the name '%s' can't be created. = Ein weiterer Wegpunkt mit dem Namen '%s' kann nicht erstellt werden.
Admin = Administrator
Bookmark '%s' added at %s type\=%s = Wegpunkt '%s' wurde bei %s vom Typ %s erstellt.
Change hud: = Ändere HUD:
Color: = Farbe:
Dist: = Entfernung:
Compass Type: = Kompasstyp:
Give the bookmark a name. = Geben Sie dem Wegpunkt einen Namen
Lets the compassgps point to the bookmark = Lässt den Kompass auf den Wegpunkt zeigen.
No = Nein
No bookmark was specified. = Kein Wegpunkt wurde angegegeben.
Pointing at %s. = Zeige auf %s.
Pointing at default location. = Zeige auf die Standardposition.
Private = Privat
Remove bookmark: = Entferne Wegpunkt:
Removes the bookmark specified by <bookmark_name> = Entfernt den Wegpunkt der mit <bookmark_name> angegeben ist.
Settings = Einstellungen
Shared = Geteilt
Show: = Zeige:
Sort by: = Sortiere nach:
Teleporting to %s = Teleportiere zu %s
The bookmark = Der Wegpunkt
The maximum number of shared bookmarks any user can create is %d. = Jeder Nutzer kann nur %d geteilte Wegpunkte erstellen.
Yes = Ja
You already have a bookmark with that name. = Sie haben bereits einen Wegpunkt mit diesem Namen.
You have no bookmark with this name. = Sie haben keinen Wegpunkt mit diesem Namen.
bookmark = Wegpunkt
compassgps reading bookmarks = compassgps liest die Wegpunkte.
compassgps reading settings = compassgps liest die Einstellungen.
compassgps = Kompass
compassgps teleporting player %s to %s = compassgps teleportiert Spieler %s nach %s.
compassgps writing settings = compassgps schreibt die Einstellungen.
compassgps.%s invalid bkrmkidx = compassgps.%s ungültige bkmrkidx.
compassgps.%s invalid bookmark playername\=%s bkmrkid\=%s = compassgps.%s ungültiger Wegpunkt Spielername\=%s bkmrkidx\=%s.
compassgps.%s player not found = compassgps.%s Spieler nicht gefunden.
compassgps: hud color not valid hex number = compassgps: HUD Farbe ist keine zulässige Hexadezimalzahl.
compassgps: hud coords are not numeric. Change to between 0 and 1 = compassgps: HUD Koordinaten sind keine Zahlen. Ändern sie diese zu Werten zwischen 0 und 1.
compassgps: hud coords out of range, hud will not be displayed. Change to between 0 and 1 to restore = compassgps: HUD Koordinaten sind außerhalb des zulässigen Bereichs. Ändern sie diese zu Werten zwischen 0 und 1 um das HUD wiederherzustellen.
compassgps:%s invalid bookmark = compassgps.%s ungültiger Wegpunkt
create admin = Erstelle Administratorwegpunkt
create bookmark = Erstelle Wegpunkt
create shared = Erstelle geteilten Wegpunkt
current position : = Momentane Position :
distance = Entfernung
find selected bookmark = Finde den ausgewählten Wegpunkt
list_bookmarks: Lists all bookmarks of a player = list_bookmarks: Zeigt alle Wegpunkte eines Spielers.
name = Name
remove bookmark = Entferne den Wegpunkt
remove bookmark playername\=%s bkmrkidx\=%s = Entferne den Wegpunkt Spielername\=%s bkmrkidx\=%s
removed %s = %s entfernt.
set_bookmark: Sets a location bookmark for the player = set_bookmark: Setzt einen Wegpunkt für den Spieler.
teleport to bookmark = Teleportiere zu dem Wegpunkt.
you can not remove someone elses bookmark: = Sie können den Wegpunkt eines anderen Spielers nicht entfernen:
CompassGPS Map (blank) = CompassGPS Karte (leer)
CompassGPS Map (marked) = CompassGPS Karte (markiert)
Write to cgpsmap = Schreibe auf die Karte
copy bookmark to your compassgps = Kopiere den Wegpunkt in ihren Kompass.
bookmark name: = Name des Wegpunkts:
bookmark pos: = Position des Wegpunkts:

View File

@ -1,63 +0,0 @@
bkmrkidx\=nil =
playername\=%s =
playername\=nil =
%s's map =
A bookmark with the name '%s' can't be created. =
Admin =
Bookmark '%s' added at %s type\=%s =
Change hud: =
Color: =
Dist: =
Compass Type: =
Give the bookmark a name. =
Lets the compassgps point to the bookmark =
No =
No bookmark was specified. =
Pointing at %s. =
Pointing at default location. =
Private =
Remove bookmark: =
Removes the bookmark specified by <bookmark_name> =
Settings =
Shared =
Show: =
Sort by: =
Teleporting to %s =
The bookmark =
The maximum number of shared bookmarks any user can create is %d. =
Yes =
You already have a bookmark with that name. =
You have no bookmark with this name. =
bookmark =
compassgps reading bookmarks =
compassgps reading settings =
compassgps =
compassgps teleporting player %s to %s =
compassgps writing settings =
compassgps.%s invalid bkrmkidx =
compassgps.%s invalid bookmark playername\=%s bkmrkid\=%s =
compassgps.%s player not found =
compassgps: hud color not valid hex number =
compassgps: hud coords are not numeric. Change to between 0 and 1 =
compassgps: hud coords out of range, hud will not be displayed. Change to between 0 and 1 to restore =
compassgps:%s invalid bookmark =
create admin =
create bookmark =
create shared =
current position : =
distance =
find selected bookmark =
list_bookmarks: Lists all bookmarks of a player =
name =
remove bookmark =
remove bookmark playername\=%s bkmrkidx\=%s =
removed %s =
set_bookmark: Sets a location bookmark for the player =
teleport to bookmark =
you can not remove someone elses bookmark: =
CompassGPS Map (blank) =
CompassGPS Map (marked) =
Write to cgpsmap =
copy bookmark to your compassgps =
bookmark name: =
bookmark pos: =

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

View File

@ -24,7 +24,6 @@ load_mod_automappercolors = true
load_mod_mapfix = true
load_mod_worldedge = true
load_mod_maze = true
load_mod_compassgps = true
load_mod_watershed = true
load_mod_bushes_classic = true