[WIP] codestyle.

This commit is contained in:
iliekprogrammar 2021-10-03 02:42:33 +08:00
parent 49e50d8e6a
commit c815277b16
1 changed files with 2 additions and 44 deletions

View File

@ -12,7 +12,7 @@ local C = minetest.colorize
--local mod_craftguide = minetest.get_modpath("mcl_craftguide") --local mod_craftguide = minetest.get_modpath("mcl_craftguide")
-- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left -- Returns a single itemstack in the given inventory to the main inventory, or drop it when there's no space left
function return_item(itemstack, dropper, pos, inv) local function return_item(itemstack, dropper, pos, inv)
if dropper:is_player() then if dropper:is_player() then
-- Return to main inventory -- Return to main inventory
if inv:room_for_item("main", itemstack) then if inv:room_for_item("main", itemstack) then
@ -40,7 +40,7 @@ function return_item(itemstack, dropper, pos, inv)
end end
-- Return items in the given inventory list (name) to the main inventory, or drop them if there is no space left -- Return items in the given inventory list (name) to the main inventory, or drop them if there is no space left
function return_fields(player, name) local function return_fields(player, name)
local inv = player:get_inventory() local inv = player:get_inventory()
local list = inv:get_list(name) local list = inv:get_list(name)
if not list then return end if not list then return end
@ -233,48 +233,6 @@ local function set_inventory(player, armor_change_only)
"listring[current_player;main]", "listring[current_player;main]",
}) })
local form2 = "size[9,8.75]"..
--"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
ppreview_formspec..
--armor
"list[current_player;armor;0,0;1,1;1]"..
"list[current_player;armor;0,1;1,1;2]"..
"list[current_player;armor;0,2;1,1;3]"..
"list[current_player;armor;0,3;1,1;4]"..
mcl_formspec.get_itemslot_bg(0,0,1,1)..
mcl_formspec.get_itemslot_bg(0,1,1,1)..
mcl_formspec.get_itemslot_bg(0,2,1,1)..
mcl_formspec.get_itemslot_bg(0,3,1,1)..
--armor_slot_imgs..
-- craft and inventory
"label[0,4;"..F(C("#313131", S("Inventory"))).."]"..
"list[current_player;main;0,4.5;9,3;9]"..
"list[current_player;main;0,7.74;9,1;]"..
"label[4,0.5;"..F(C("#313131", S("Crafting"))).."]"..
"list[current_player;craft;4,1;2,2]"..
"list[current_player;craftpreview;7,1.5;1,1;]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
mcl_formspec.get_itemslot_bg(4,1,2,2)..
mcl_formspec.get_itemslot_bg(7,1.5,1,1)..
-- crafting guide button
"image_button[4.5,3;1,1;craftguide_book.png;__mcl_craftguide;]"..
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]"..
-- help button
"image_button[8,3;1,1;doc_button_icon_lores.png;__mcl_doc;]"..
"tooltip[__mcl_doc;"..F(S("Help")).."]"..
-- skins button
"image_button[3,3;1,1;mcl_skins_button.png;__mcl_skins;]"..
"tooltip[__mcl_skins;"..F(S("Select player skin")).."]"..
-- achievements button
"image_button[7,3;1,1;mcl_achievements_button.png;__mcl_achievements;]"..
"tooltip[__mcl_achievements;"..F(S("Achievements")).."]"..
-- for shortcuts
"listring[current_player;main]"..
"listring[current_player;armor]"..
"listring[current_player;main]" ..
"listring[current_player;craft]" ..
"listring[current_player;main]"
player:set_inventory_formspec(form) player:set_inventory_formspec(form)
end end