mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-11-26 14:23:45 +01:00
Code tidy
This commit is contained in:
parent
6f99803d2d
commit
579e64a5e7
@ -464,25 +464,23 @@ armor.deserialize_inventory_list = function(self, list_string)
|
|||||||
end
|
end
|
||||||
|
|
||||||
armor.load_armor_inventory = function(self, player)
|
armor.load_armor_inventory = function(self, player)
|
||||||
local name, inv = self:get_valid_player(player, "[load_armor_inventory]")
|
local _, inv = self:get_valid_player(player, "[load_armor_inventory]")
|
||||||
if not name then
|
if inv then
|
||||||
return
|
local armor_list_string = player:get_attribute("3d_armor_inventory")
|
||||||
end
|
if armor_list_string then
|
||||||
local armor_list_string = player:get_attribute("3d_armor_inventory")
|
inv:set_list("armor",
|
||||||
if armor_list_string then
|
self:deserialize_inventory_list(armor_list_string))
|
||||||
inv:set_list("armor",
|
return true
|
||||||
self:deserialize_inventory_list(armor_list_string))
|
end
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
armor.save_armor_inventory = function(self, player)
|
armor.save_armor_inventory = function(self, player)
|
||||||
local name, inv = self:get_valid_player(player, "[save_armor_inventory]")
|
local _, inv = self:get_valid_player(player, "[save_armor_inventory]")
|
||||||
if not name then
|
if inv then
|
||||||
return
|
player:set_attribute("3d_armor_inventory",
|
||||||
|
self:serialize_inventory_list(inv:get_list("armor")))
|
||||||
end
|
end
|
||||||
player:set_attribute("3d_armor_inventory",
|
|
||||||
self:serialize_inventory_list(inv:get_list("armor")))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
armor.update_inventory = function(self, player)
|
armor.update_inventory = function(self, player)
|
||||||
@ -490,7 +488,7 @@ armor.update_inventory = function(self, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
armor.set_inventory_stack = function(self, player, i, stack)
|
armor.set_inventory_stack = function(self, player, i, stack)
|
||||||
local name, inv = self:get_valid_player(player, "[set_inventory_stack]")
|
local _, inv = self:get_valid_player(player, "[set_inventory_stack]")
|
||||||
if inv then
|
if inv then
|
||||||
inv:set_stack("armor", i, stack)
|
inv:set_stack("armor", i, stack)
|
||||||
self:save_armor_inventory(player)
|
self:save_armor_inventory(player)
|
||||||
|
Loading…
Reference in New Issue
Block a user