summaryrefslogtreecommitdiff
path: root/api.lua
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2018-03-28 18:39:48 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2018-03-28 18:39:48 +0100
commit28dc0d8be5450ad5289c5b1053af83881ae1004c (patch)
tree8d0ffb2a712b491c6387914d9eb98ca76ae1cad7 /api.lua
parenta654a0250539e97d2d78ebe5438750dd22a6fa8f (diff)
add nametag check when renaming
Diffstat (limited to 'api.lua')
-rw-r--r--api.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/api.lua b/api.lua
index d00b526..b3eb81a 100644
--- a/api.lua
+++ b/api.lua
@@ -3,7 +3,7 @@
mobs = {}
mobs.mod = "redo"
-mobs.version = "20180324"
+mobs.version = "20180328"
-- Intllib
@@ -3731,6 +3731,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
end
+ -- make sure nametag is being used to name mob
+ local item = player:get_wielded_item()
+
+ if item:get_name() ~= "mobs:nametag" then
+ return
+ end
+
-- limit name entered to 64 characters long
if string.len(fields.name) > 64 then
fields.name = string.sub(fields.name, 1, 64)