From baeca50318120381238bddb9a9cb43bdfc784566 Mon Sep 17 00:00:00 2001 From: Louis <55180044+louisroyer@users.noreply.github.com> Date: Tue, 11 Aug 2020 15:09:57 +0200 Subject: [PATCH] Add toolranks_extras support This displays `bow level x` instead of `tool level x` when toolranks is enabled, and display `Arrows thrown` instead of `Node dug`. --- init.lua | 5 +++++ locale/template.txt | 7 +++++++ locale/throwing.fr.tr | 7 +++++++ mod.conf | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 locale/template.txt create mode 100644 locale/throwing.fr.tr diff --git a/init.lua b/init.lua index 4d7abee..0983948 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,7 @@ throwing.target_node = 2 throwing.target_both = 3 throwing.modname = minetest.get_current_modname() +local S = minetest.get_translator("throwing") local use_toolranks = minetest.get_modpath("toolranks") and minetest.settings:get_bool("throwing.toolranks", true) --------- Arrows functions --------- @@ -348,6 +349,10 @@ end ---------- Bows ----------- +if use_toolranks and minetest.get_modpath("toolranks_extras") and toolranks_extras.register_tool_type then + toolranks_extras.register_tool_type("bow", S("bow"), S("Arrows thrown")) +end + function throwing.register_bow(name, def) local enable_toolranks = use_toolranks and not def.no_toolranks diff --git a/locale/template.txt b/locale/template.txt new file mode 100644 index 0000000..d46b065 --- /dev/null +++ b/locale/template.txt @@ -0,0 +1,7 @@ +# textdomain: throwing + + +### init.lua ### + +Arrows thrown= +bow= diff --git a/locale/throwing.fr.tr b/locale/throwing.fr.tr new file mode 100644 index 0000000..c42ecdb --- /dev/null +++ b/locale/throwing.fr.tr @@ -0,0 +1,7 @@ +# textdomain: throwing + + +### init.lua ### + +Arrows thrown=Flèches lancées +bow=arc diff --git a/mod.conf b/mod.conf index 8bc0a97..8cbd9e3 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,3 @@ name = throwing -optional_depends = wielded_light, toolranks +optional_depends = wielded_light, toolranks, toolranks_extras description = Throwing library: provides an API for registering throwing and throwable things