From be1cda9464880d26f72b97774ae26b373154613f Mon Sep 17 00:00:00 2001 From: Araca <14837771+Aracaa@users.noreply.github.com> Date: Thu, 1 Feb 2024 19:04:38 +0100 Subject: [PATCH] Adapt inventory to MineClone2/ia (#18) Co-authored-by: Florent Delord --- init.lua | 17 ++++++++++------- locale/trash_can.fr.tr | 5 +++++ 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 locale/trash_can.fr.tr diff --git a/init.lua b/init.lua index 14ba020..39151f4 100644 --- a/init.lua +++ b/init.lua @@ -15,7 +15,7 @@ if mineclone_path then -- means MineClone 2 is loaded moditems.boxart = "bgcolor[#d0d0d0;false]listcolors[#9d9d9d;#9d9d9d;#5c5c5c;#000000;#ffffff]" moditems.trashbin_groups = {pickaxey=1,axey=1,handy=1,swordy=1,flammable=1,destroy_by_lava_flow=1,craftitem=1} moditems.dumpster_groups = {pickaxey=1,axey=1,handy=1,swordy=1,flammable=0,destroy_by_lava_flow=0,craftitem=1} - + moditems.slot_per_row = 9 else -- fallback, assume default (Minetest Game) is loaded moditems.iron_item = "default:steel_ingot" -- MTG iron ingot moditems.coal_item = "default:coalblock" -- MTG coal block @@ -26,6 +26,7 @@ else -- fallback, assume default (Minetest Game) is loaded moditems.boxart = "" moditems.trashbin_groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3} moditems.dumpster_groups = {cracky=3,oddly_breakable_by_hand=1} + moditems.slot_per_row = 8 end @@ -116,11 +117,12 @@ minetest.register_node("trash_can:trash_can_wooden",{ _mcl_hardness = 1, on_construct = function(pos) local meta = minetest.get_meta(pos) + local offset = moditems.slot_per_row / 2 - 1 meta:set_string("formspec", - "size[8,9]" .. + "size["..moditems.slot_per_row..",9]" .. "button[0,0;2,1;empty;" .. S("Empty Trash") .. "]" .. - "list[context;trashlist;3,1;2,3;]" .. - "list[current_player;main;0,5;8,4;]" .. + "list[context;trashlist;"..offset..",1;2,3;]" .. + "list[current_player;main;0,5;"..moditems.slot_per_row..",4;]" .. "listring[]" .. moditems.boxart ) @@ -187,11 +189,12 @@ minetest.register_node("trash_can:dumpster", { sounds = get_dumpster_sound(), on_construct = function(pos) local meta = minetest.get_meta(pos) + local offset = moditems.slot_per_row / 2 - 3 meta:set_string("formspec", - "size[8,9]" .. + "size["..moditems.slot_per_row..",9]" .. "button[0,0;2,1;empty;" .. S("Empty Trash") .. "]" .. - "list[context;main;1,1;6,3;]" .. - "list[current_player;main;0,5;8,4;]".. + "list[context;main;"..offset..",1;6,3;]" .. + "list[current_player;main;0,5;"..moditems.slot_per_row..",4;]".. "listring[]" .. moditems.boxart ) diff --git a/locale/trash_can.fr.tr b/locale/trash_can.fr.tr new file mode 100644 index 0000000..1006d32 --- /dev/null +++ b/locale/trash_can.fr.tr @@ -0,0 +1,5 @@ +# textdomain: trash_can +Trash Can=Poubelle +Dumpster=Containeur +Wooden Trash Can=Poubelle en bois +Empty Trash=Vider