From 2026249d90bd76c367bb35e4735b1bdfe92de293 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 29 Oct 2016 18:14:30 +0200 Subject: [PATCH] Add (slightly) experimental binoculars --- README.md | 10 +++++-- init.lua | 33 +++++++++++++++++++++++ locale/de.txt | 3 +++ locale/template.txt | 4 +++ textures/orienteering_binoculars.png | Bin 0 -> 685 bytes textures/orienteering_binoculars_inv.png | Bin 0 -> 741 bytes 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 textures/orienteering_binoculars.png create mode 100644 textures/orienteering_binoculars_inv.png diff --git a/README.md b/README.md index 8f94bb0..dcce423 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,9 @@ The following tools are available: * Speedometer: Shows speed in m/s (1 m = side length of a single cube) * Automapper: Enables the usage of the minimap and radar (F7 key by default) * GPS device: Shows X, Y, Z coordinates, yaw and time -* Quadcorder: Ultimate tool: Shows X, Y, Z coordinates, pitch, yaw, time, speed - and enables minimap/radar +* Quadcorder: Combination of everything above: Shows X, Y, Z coordinates, pitch, + yaw, time, speed and enables minimap/radar +* Binoculars: Allows you to zoom (must wield to use) To toggle between 12h and 24h mode for the displayed time, wield any device which is capable of displaying the time and press the left mouse button. @@ -123,6 +124,11 @@ Symbols: 6D7 4D8 +### Binoculars + + g g + S S + SSS diff --git a/init.lua b/init.lua index 1eb0934..b1e687a 100644 --- a/init.lua +++ b/init.lua @@ -107,6 +107,13 @@ minetest.register_tool("orienteering:automapper", { inventory_image = "orienteering_automapper_inv.png", }) +-- Allows zooming +minetest.register_tool("orienteering:binoculars", { + description = S("Binoculars"), + wield_image = "orienteering_binoculars.png", + inventory_image = "orienteering_binoculars_inv.png", +}) + -- Displays X,Y,Z coordinates, yaw and game time minetest.register_tool("orienteering:gps", { description = S("GPS device"), @@ -201,6 +208,27 @@ function orienteering.update_automapper(player) end end +function orienteering.update_binoculars(player) + local wielding = player:get_wielded_item() + local playername = player:get_player_name() + local privs = minetest.get_player_privs(playername) + if not wielding:is_empty() and wielding:get_name() == "orienteering:binoculars" then + -- Has binoculars + if privs.zoom ~= true then + privs.zoom = true + minetest.set_player_privs(playername, privs) + end + else + -- Does not have binoculars + if privs.zoom == true then + privs.zoom = nil + minetest.set_player_privs(playername, privs) + end + end +end + + + -- Checks whether a certain orienteering tool is “active” and ready for use function orienteering.tool_active(player, item) -- Requirement: player carries the tool in the hotbar @@ -216,6 +244,7 @@ end function orienteering.init_hud(player) orienteering.update_automapper(player) + orienteering.update_binoculars(player) local name = player:get_player_name() orienteering.playerhuds[name] = {} for i=1, o_lines do @@ -356,6 +385,7 @@ minetest.register_globalstep(function(dtime) local players = minetest.get_connected_players() for i=1, #players do orienteering.update_automapper(players[i]) + orienteering.update_binoculars(players[i]) orienteering.update_hud_displays(players[i]) end updatetimer = updatetimer - dtime @@ -386,12 +416,14 @@ if minetest.get_modpath("doc_items") ~= nil then ["orienteering:watch"] = S("It shows you the current time."), ["orienteering:quadcorder"] = S("This is the ultimate orientieering tool. It shows you your coordinates (X, Y and Z), shows your yaw and pitch (horizontal and vertical viewing angles), the current time, your current speed and it enables you to access the minimap."), ["orienteering:automapper"] = S("The automapper automatically creates a map of the area around you and enables you to view a minimap of your surroundings. It also has a built-in radar."), + ["orienteering:binoculars"] = S("Binoculars allow you to zoom."), }) local use = S("Put this tool in your hotbar to see the data it provides.") local use_watch = S("Put the watch in your hotbar to see the time. Leftclick to toggle between the 24-hour and 12-hour display.") local use_time = S("Put this tool in your hotbar to make use of its functionality. Leftclick to toggle between 24-hour and 12-hour display for the time feature.") local use_automapper = S("If you put an automapper in your hotbar, you will be able to access the minimap. By default the minimap can be opened with [F7].") + local use_binoculars = S("Wield the binoculars to be able to zoom. Hold down the Zoom key (default: [Z]) to zoom.") doc.sub.items.set_items_usagehelp({ ["orienteering:compass"] = use, @@ -403,5 +435,6 @@ if minetest.get_modpath("doc_items") ~= nil then ["orienteering:watch"] = use_watch, ["orienteering:quadcorder"] = use_time, ["orienteering:automapper"] = use_automapper, + ["orienteering:binoculars"] = use_binoculars, }) end diff --git a/locale/de.txt b/locale/de.txt index b240cb3..945cd79 100644 --- a/locale/de.txt +++ b/locale/de.txt @@ -7,6 +7,7 @@ Watch = Uhr Speedometer = Tacho Automapper = Autokartierer GPS device = GPS-Gerät +Binoculars = Fernglas Yaw: %.1f°, pitch: %.1f° = Gier: %.1f°, Nick: %.1f° Yaw: %.1f° = Gier: %.1f° @@ -40,9 +41,11 @@ It shows you your current horizontal (“hor.”) and vertical (“ver.”) spee It shows you the current time. = Es zeigt Ihnen die aktuelle Uhrzeit. This is the ultimate orientieering tool. It shows you your coordinates (X, Y and Z), shows your yaw and pitch (horizontal and vertical viewing angles), the current time, your current speed and it enables you to access the minimap. = Dies ist das ultimative Werkzeug für die Orientierung. Es zeigt Ihnen Ihre aktuellen Koordinaten (X, Y, und Z), zeigt Ihren Gier- und Nickwinkel (horizontaler und vertikaler Blickwinkel), die aktuelle Uhrzeit, Ihre aktuelle Geschwindigkeit und es ermöglicht es Ihnen, auf die Kleinkarte zuzugreifen. The automapper automatically creates a map of the area around you and enables you to view a minimap of your surroundings. It also has a built-in radar. = Der Autokartierer erstellt automatisch eine Karte von Ihrer näheren Umgebung und ermöglicht es Ihnen, eine Kleinkarte davon zu betrachten. Er hat außerdem einen eingebauten Radar. +Binoculars allow you to zoom. = Ein Ferglas ermöglicht es Ihnen, die Ansicht zu vergrößern. Put this tool in your hotbar to see the data it provides. = Legen Sie dieses Werkzeug in Ihrer Schnellzugriffsleiste ab, um die dazugehörigen Daten zu sehen. Put the watch in your hotbar to see the time. Leftclick to toggle between the 24-hour and 12-hour display. = Legen Sie die Uhr in Ihrer Schnellzugriffsleiste ab, um die Uhrzeit zu sehen. Mit Linksklick können Sie zwischen der 24-Stunden- und der 2-mal-12-Stunden-Anzeige wechseln. Put this tool in your hotbar to make use of its functionality. Leftclick to toggle between 24-hour and 12-hour display for the time feature. = Legen Sie dieses Werkzeug irgendwo in Ihrem Spielerinventar ab, um davon Gebrauch zu machen. Mit Linksklick können Sie zwischen der 24-Stunden- und der 2-mal-12-Stunden-Anzeige der Uhrenfunktion wechseln. If you put an automapper in your hotbar, you will be able to access the minimap. By default the minimap can be opened with [F7]. = Wenn Sie einen Autokartierer in Ihrer Schnellzugriffsleiste ablegen, können Sie auf die Kleinkarte zugreifen. Standardmäßig kann die Kleinkarte mit [F7] geöffnet werden. +Wield the binoculars to be able to zoom. Hold down the Zoom key (default: [Z]) to zoom. = Halten Sie das Fernglas, um in der Lage zu sein, die Ansicht zu vergrößern. Halten Sie die Zoomtaste (Standard: [Z]) gedrückt, um die Ansicht zu vergrößern. diff --git a/locale/template.txt b/locale/template.txt index cac0b8d..aee7efa 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -8,6 +8,7 @@ Watch Speedometer Automapper GPS device +Binoculars # Coordinates Coordinates: X\=%d, Y\=%d, Z\=%d @@ -53,8 +54,11 @@ It shows you your current horizontal (“hor.”) and vertical (“ver.”) spee It shows you the current time. This is the ultimate orientieering tool. It shows you your coordinates (X, Y and Z), shows your yaw and pitch (horizontal and vertical viewing angles), the current time, your current speed and it enables you to access the minimap. The automapper automatically creates a map of the area around you and enables you to view a minimap of your surroundings. It also has a built-in radar. +Binoculars allow you to zoom. Put this tool in your hotbar to see the data it provides. Put the watch in your hotbar to see the time. Leftclick to toggle between the 24-hour and 12-hour display. Put this tool in your hotbar to make use of its functionality. Leftclick to toggle between 24-hour and 12-hour display for the time feature. If you put an automapper in your hotbar, you will be able to access the minimap. By default the minimap can be opened with [F7]. +Wield the binoculars to be able to zoom. Hold down the Zoom key (default: [Z]) to zoom. + diff --git a/textures/orienteering_binoculars.png b/textures/orienteering_binoculars.png new file mode 100644 index 0000000000000000000000000000000000000000..7004b5c288f6ad70d2c77fdb7b5bb24b563f0fea GIT binary patch literal 685 zcmV;e0#f~nP)Px#32;bRa{vGi!~g&e!~vBn4jTXf00(qQO+^Rb3LOtFBIjr+Gynhq3~5wYbVF}# zZDnqB000000KBfUnE(I+CrLy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