diff --git a/mods/mtg/mtg_map/README.txt b/mods/mtg/mtg_map/README.txt new file mode 100644 index 0000000..068439a --- /dev/null +++ b/mods/mtg/mtg_map/README.txt @@ -0,0 +1,44 @@ +Minetest Game mod: map +====================== +See license.txt for license information. + +Authors of source code +---------------------- +paramat (MIT) + +Authors of media (textures) +--------------------------- +TumeniNodes (CC BY-SA 3.0): + map_mapping_kit.png (map) + +paramat (CC BY-SA 3.0): + map_mapping_kit.png (compass and pen) + +Crafting +-------- +map:mapping_kit + +default:glass G +default:paper P +group:stick S +default:steel_ingot I +group:wood W +dye:black D + +GPS +IPI +WPD + +Usage +----- +In survival mode, use of the minimap requires the mapping kit item in your +inventory. It can take up to 5 seconds for adding to or removal from inventory +to have an effect, however to instantly allow the use of the minimap 'use' +(leftclick) the item. +Minimap radar mode is always disallowed in survival mode. + +Minimap and minimap radar mode are automatically allowed in creative mode and +for any player with the 'creative' privilege. + +The 'map.update_hud_flags()' function is global so can be redefined by a mod for +alternative behaviour. diff --git a/mods/mtg/mtg_map/init.lua b/mods/mtg/mtg_map/init.lua new file mode 100644 index 0000000..b91e528 --- /dev/null +++ b/mods/mtg/mtg_map/init.lua @@ -0,0 +1,80 @@ +-- map/init.lua + +-- Mod global namespace + +map = {} + + +-- Load support for MT game translation. +local S = minetest.get_translator("map") + + +-- Update HUD flags +-- Global to allow overriding + +function map.update_hud_flags(player) + local creative_enabled = minetest.is_creative_enabled(player:get_player_name()) + + local minimap_enabled = creative_enabled or + player:get_inventory():contains_item("main", "map:mapping_kit") + local radar_enabled = creative_enabled + + player:hud_set_flags({ + minimap = minimap_enabled, + minimap_radar = radar_enabled + }) +end + + +-- Set HUD flags 'on joinplayer' + +minetest.register_on_joinplayer(function(player) + map.update_hud_flags(player) +end) + + +-- Cyclic update of HUD flags + +local function cyclic_update() + for _, player in ipairs(minetest.get_connected_players()) do + map.update_hud_flags(player) + end + minetest.after(5.3, cyclic_update) +end + +minetest.after(5.3, cyclic_update) + + +-- Mapping kit item + +minetest.register_craftitem("map:mapping_kit", { + description = S("Mapping Kit") .. "\n" .. S("Use with 'Minimap' key"), + inventory_image = "map_mapping_kit.png", + stack_max = 1, + groups = {flammable = 3, tool = 1}, + + on_use = function(itemstack, user, pointed_thing) + map.update_hud_flags(user) + end, +}) + + +-- Crafting + +minetest.register_craft({ + output = "map:mapping_kit", + recipe = { + {"default:glass", "default:paper", "group:stick"}, + {"default:steel_ingot", "default:paper", "default:steel_ingot"}, + {"group:wood", "default:paper", "dye:black"}, + } +}) + + +-- Fuel + +minetest.register_craft({ + type = "fuel", + recipe = "map:mapping_kit", + burntime = 5, +}) diff --git a/mods/mtg/mtg_map/license.txt b/mods/mtg/mtg_map/license.txt new file mode 100644 index 0000000..a89f59c --- /dev/null +++ b/mods/mtg/mtg_map/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2017 paramat + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2017 TumeniNodes +Copyright (C) 2017 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/mtg/mtg_map/locale/map.de.tr b/mods/mtg/mtg_map/locale/map.de.tr new file mode 100644 index 0000000..1a784ab --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.de.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Kartenset +Use with 'Minimap' key=Mit „Karte an/aus“-Taste benutzen diff --git a/mods/mtg/mtg_map/locale/map.eo.tr b/mods/mtg/mtg_map/locale/map.eo.tr new file mode 100644 index 0000000..15c1cab --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.eo.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Mapa Ilaro +Use with 'Minimap' key=Uzu per 'malgrandmapo' ŝlosilo diff --git a/mods/mtg/mtg_map/locale/map.es.tr b/mods/mtg/mtg_map/locale/map.es.tr new file mode 100644 index 0000000..0faed52 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.es.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Kit de cartografía +Use with 'Minimap' key=Usar con la tecla 'Minimapa' diff --git a/mods/mtg/mtg_map/locale/map.fr.tr b/mods/mtg/mtg_map/locale/map.fr.tr new file mode 100644 index 0000000..29f8e20 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.fr.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Kit de carthographie +Use with 'Minimap' key=Utiliser avec le bouton « Minimap » diff --git a/mods/mtg/mtg_map/locale/map.id.tr b/mods/mtg/mtg_map/locale/map.id.tr new file mode 100644 index 0000000..cb31d0f --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.id.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Alat Pemetaan +Use with 'Minimap' key=Pakai dengan tombol 'Peta Mini' diff --git a/mods/mtg/mtg_map/locale/map.it.tr b/mods/mtg/mtg_map/locale/map.it.tr new file mode 100644 index 0000000..59885e9 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.it.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Kit di mappatura +Use with 'Minimap' key=Usalo col tasto 'Minimappa' diff --git a/mods/mtg/mtg_map/locale/map.ja.tr b/mods/mtg/mtg_map/locale/map.ja.tr new file mode 100644 index 0000000..7205f24 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.ja.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=地図キット +Use with 'Minimap' key=ミニマップキーで使います diff --git a/mods/mtg/mtg_map/locale/map.jbo.tr b/mods/mtg/mtg_map/locale/map.jbo.tr new file mode 100644 index 0000000..8f37c18 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.jbo.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=lo cartu ke sidju bakfu +Use with 'Minimap' key=.i tu'a le cmalu cartu batke cu tadji lo nu pilno diff --git a/mods/mtg/mtg_map/locale/map.ms.tr b/mods/mtg/mtg_map/locale/map.ms.tr new file mode 100644 index 0000000..8564f91 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.ms.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Alat Pemetaan +Use with 'Minimap' key=Guna dengan kekunci 'Peta Mini' diff --git a/mods/mtg/mtg_map/locale/map.pt_BR.tr b/mods/mtg/mtg_map/locale/map.pt_BR.tr new file mode 100644 index 0000000..0095c39 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.pt_BR.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Kit de mapeamento +Use with 'Minimap' key=Use com a tecla do 'mini-mapa' diff --git a/mods/mtg/mtg_map/locale/map.ru.tr b/mods/mtg/mtg_map/locale/map.ru.tr new file mode 100644 index 0000000..73120b6 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.ru.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Картографический комплект +Use with 'Minimap' key=Используйте с ключом 'Minimap' diff --git a/mods/mtg/mtg_map/locale/map.sk.tr b/mods/mtg/mtg_map/locale/map.sk.tr new file mode 100644 index 0000000..2016c85 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.sk.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Kartografická súprava +Use with 'Minimap' key=Použi klávesou 'Prepni minimpu' diff --git a/mods/mtg/mtg_map/locale/map.sv.tr b/mods/mtg/mtg_map/locale/map.sv.tr new file mode 100644 index 0000000..bc79d44 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.sv.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Kartläggningssats +Use with 'Minimap' key=Använd med 'Minimap'-tangent diff --git a/mods/mtg/mtg_map/locale/map.uk.tr b/mods/mtg/mtg_map/locale/map.uk.tr new file mode 100644 index 0000000..3f58b78 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.uk.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=Картографічний Комплект +Use with 'Minimap' key=Використовуйте за допомогою ключа 'Minimap' diff --git a/mods/mtg/mtg_map/locale/map.zh_CN.tr b/mods/mtg/mtg_map/locale/map.zh_CN.tr new file mode 100644 index 0000000..cec95bb --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.zh_CN.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=地图绘制工具包 +Use with 'Minimap' key=与“迷你地图”键一起使用 diff --git a/mods/mtg/mtg_map/locale/map.zh_TW.tr b/mods/mtg/mtg_map/locale/map.zh_TW.tr new file mode 100644 index 0000000..a098124 --- /dev/null +++ b/mods/mtg/mtg_map/locale/map.zh_TW.tr @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit=地圖繪製工具包 +Use with 'Minimap' key=與“迷你地圖”鍵一起使用 diff --git a/mods/mtg/mtg_map/locale/template.txt b/mods/mtg/mtg_map/locale/template.txt new file mode 100644 index 0000000..2dbe2ee --- /dev/null +++ b/mods/mtg/mtg_map/locale/template.txt @@ -0,0 +1,3 @@ +# textdomain: map +Mapping Kit= +Use with 'Minimap' key= diff --git a/mods/mtg/mtg_map/mod.conf b/mods/mtg/mtg_map/mod.conf new file mode 100644 index 0000000..bb045c7 --- /dev/null +++ b/mods/mtg/mtg_map/mod.conf @@ -0,0 +1,3 @@ +name = map +description = Minetest Game mod: map +depends = default, dye diff --git a/mods/mtg/mtg_map/textures/map_mapping_kit.png b/mods/mtg/mtg_map/textures/map_mapping_kit.png new file mode 100644 index 0000000..015b878 Binary files /dev/null and b/mods/mtg/mtg_map/textures/map_mapping_kit.png differ diff --git a/mods/mtg/mtg_player_api/api.lua b/mods/mtg/mtg_player_api/api.lua index 0979b4f..b3e3f5e 100644 --- a/mods/mtg/mtg_player_api/api.lua +++ b/mods/mtg/mtg_player_api/api.lua @@ -178,8 +178,8 @@ function minetest.calculate_knockback(player, ...) end -- Check each player and apply animations -function player_api.globalstep() - for _, player in ipairs(minetest.get_connected_players()) do +minetest.register_globalstep(function() + for _, player in pairs(minetest.get_connected_players()) do local name = player:get_player_name() local player_data = players[name] local model = models[player_data.model] @@ -208,11 +208,6 @@ function player_api.globalstep() end end end -end - --- Mods can modify the globalstep by overriding player_api.globalstep -minetest.register_globalstep(function(...) - player_api.globalstep(...) end) for _, api_function in pairs({"get_animation", "set_animation", "set_model", "set_textures"}) do