forked from mtcontrib/maidroid
[FIX] Fix register_on_player_receive_fields position
This commit is contained in:
parent
6d8e4b662d
commit
a1ad98fc4e
@ -147,6 +147,26 @@ end) ()
|
|||||||
|
|
||||||
local formspec_opened_selves = {}
|
local formspec_opened_selves = {}
|
||||||
|
|
||||||
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
|
if formname ~= "maidroid:gui" then return end
|
||||||
|
|
||||||
|
local self = formspec_opened_selves[player]
|
||||||
|
|
||||||
|
if not self then return end
|
||||||
|
|
||||||
|
if fields.name then
|
||||||
|
if fields.name == "" then
|
||||||
|
self.nametag = self.inventory_name
|
||||||
|
else
|
||||||
|
self.nametag = fields.name
|
||||||
|
end
|
||||||
|
|
||||||
|
self.object:set_nametag_attributes{
|
||||||
|
text = self.nametag
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- maidroid.register_core registers a definition of a new core.
|
-- maidroid.register_core registers a definition of a new core.
|
||||||
function maidroid.register_core(core_name, def)
|
function maidroid.register_core(core_name, def)
|
||||||
maidroid.registered_cores[core_name] = def
|
maidroid.registered_cores[core_name] = def
|
||||||
@ -404,23 +424,3 @@ function maidroid.register_maidroid(product_name, def)
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
if formname ~= "maidroid:gui" then return end
|
|
||||||
|
|
||||||
local self = formspec_opened_selves[player]
|
|
||||||
|
|
||||||
if not self then return end
|
|
||||||
|
|
||||||
if fields.name then
|
|
||||||
if fields.name == "" then
|
|
||||||
self.nametag = self.inventory_name
|
|
||||||
else
|
|
||||||
self.nametag = fields.name
|
|
||||||
end
|
|
||||||
|
|
||||||
self.object:set_nametag_attributes{
|
|
||||||
text = self.nametag
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user