summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua35
1 files changed, 12 insertions, 23 deletions
diff --git a/api.lua b/api.lua
index 23bfeee..8e3b652 100644
--- a/api.lua
+++ b/api.lua
@@ -7,19 +7,8 @@ mobs.version = "20170704"
-- Intllib
-local S
-
-if minetest.get_modpath("intllib") then
- S = intllib.Getter()
-else
- S = function(s, a, ...) a = {a, ...}
- return s:gsub("@(%d+)", function(n)
- return a[tonumber(n)]
- end)
- end
-
-end
-
+local MP = minetest.get_modpath(minetest.get_current_modname())
+local S, NS = dofile(MP .. "/intllib.lua")
mobs.intllib = S
@@ -2025,14 +2014,14 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir)
-- error checking when mod profiling is enabled
if not tool_capabilities then
- print (S("[MOBS] mod profiling enabled, damage not enabled"))
+ minetest.log("warning", "[mobs] Mod profiling enabled, damage not enabled")
return
end
-- is mob protected?
if self.protected and hitter:is_player()
and minetest.is_protected(self.object:getpos(), hitter:get_player_name()) then
- minetest.chat_send_player(hitter:get_player_name(), "Mob has been protected!")
+ minetest.chat_send_player(hitter:get_player_name(), S("Mob has been protected!"))
return
end
@@ -2707,12 +2696,12 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
aoc = tonumber(numbers[2]) or aoc
if chance == 0 then
- print(S("[Mobs Redo] @1 has spawning disabled", name))
+ minetest.log("warning", string.format("[mobs] %s has spawning disabled", name))
return
end
- print (S("[Mobs Redo] Chance setting for @1 changed to @2", name, chance)
- .. " (total: " .. aoc .. ")")
+ minetest.log("action",
+ string.format("[mobs] Chance setting for %s changed to %s (total: %s)", name, chance, aoc))
end
@@ -2823,8 +2812,8 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
return
end
else
- print (S("[mobs] @1 failed to spawn at @2",
- name, minetest.pos_to_string(pos)))
+ minetest.log("warning", string.format("[mobs] %s failed to spawn at %s",
+ name, minetest.pos_to_string(pos)))
end
end
@@ -3099,7 +3088,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
-- register new spawn egg containing mob information
minetest.register_craftitem(mob .. "_set", {
- description = desc .. " (Tamed)",
+ description = S("@1 (Tamed)", desc),
inventory_image = invimg,
groups = {spawn_egg = 2, not_in_creative_inventory = 1},
stack_max = 1,
@@ -3462,8 +3451,8 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame)
minetest.show_formspec(name, "mobs_nametag", "size[8,4]"
.. default.gui_bg
.. default.gui_bg_img
- .. "field[0.5,1;7.5,0;name;" .. S("Enter name:") .. ";" .. tag .. "]"
- .. "button_exit[2.5,3.5;3,1;mob_rename;" .. S("Rename") .. "]")
+ .. "field[0.5,1;7.5,0;name;" .. minetest.formspec_escape(S("Enter name:")) .. ";" .. tag .. "]"
+ .. "button_exit[2.5,3.5;3,1;mob_rename;" .. minetest.formspec_escape(S("Rename")) .. "]")
end