mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2024-12-24 09:40:21 +01:00
add nametag check when renaming
This commit is contained in:
parent
a654a02505
commit
28dc0d8be5
9
api.lua
9
api.lua
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
mobs.version = "20180324"
|
mobs.version = "20180328"
|
||||||
|
|
||||||
|
|
||||||
-- Intllib
|
-- Intllib
|
||||||
@ -3731,6 +3731,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
return
|
return
|
||||||
end
|
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
|
-- limit name entered to 64 characters long
|
||||||
if string.len(fields.name) > 64 then
|
if string.len(fields.name) > 64 then
|
||||||
fields.name = string.sub(fields.name, 1, 64)
|
fields.name = string.sub(fields.name, 1, 64)
|
||||||
|
Loading…
Reference in New Issue
Block a user