From 5e7f552f5b2c7287f0f90d25d9914490dd32cc8e Mon Sep 17 00:00:00 2001 From: daretmavi Date: Fri, 19 Mar 2021 00:06:25 +0100 Subject: [PATCH] i3 trash only on creative --- buildscripts/03_my_updates.sh | 4 ++-- mods/gui/i3/init.lua | 13 ++++++++---- my_changes/gui/i3/notrash.patch | 35 +++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 my_changes/gui/i3/notrash.patch diff --git a/buildscripts/03_my_updates.sh b/buildscripts/03_my_updates.sh index 50d5ec6..6b29604 100755 --- a/buildscripts/03_my_updates.sh +++ b/buildscripts/03_my_updates.sh @@ -47,7 +47,7 @@ buildings/doors:doors_update.patch" "buildings/doors:doors_update54.patch" \ "player/fire_plus:extend_fire.patch" \ "mobs/mobs_mobs/advanced_npc:adv_npc_log.patch" "mobs/mobs_mobs/advanced_npc:bugtrade184.patch" \ "mobs/mobs_mobs/mg_villages_npc:bug.patch" "mobs/mobs_mobs/mg_villages_npc:patch_log.patch" \ -"gui/i3:progressive_creative.patch") +"gui/i3:progressive_creative.patch" "gui/i3:notrash.patch") #"mobs/mobs_mobs/goblins:goblins_nil.patch" #MOD_PATCHES=( ) @@ -80,7 +80,7 @@ do SRC_DIR="$SRC${MOD_PATH[MOD_INDEX]}/" DST_DIR="$DST${MOD_PATH[MOD_INDEX]}/" - echo "---------------------------------------------------------------" + #echo "---------------------------------------------------------------" echo "Apllying patch ${MOD_PATCH[MOD_INDEX]} to ${MOD_PATH[MOD_INDEX]}." echo diff --git a/mods/gui/i3/init.lua b/mods/gui/i3/init.lua index 811b5c6..a5f9a34 100644 --- a/mods/gui/i3/init.lua +++ b/mods/gui/i3/init.lua @@ -1874,9 +1874,13 @@ local function get_ctn_content(fs, data, player, xoffset, yoffset, ctn_len, awar fs(fmt("list[current_player;craft;%f,%f;3,3;]", xoffset, yoffset + 1.45), fmt("image", xoffset + 3.47, yoffset + 2.69, 0.85, 0.85, PNG.arrow), - fmt("list[current_player;craftpreview;%f,%f;1,1;]", xoffset + 4.45, yoffset + 2.6), - fmt("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.75), - fmt("image", xoffset + 4.45, yoffset + 3.75, 1, 1, PNG.trash)) + fmt("list[current_player;craftpreview;%f,%f;1,1;]", xoffset + 4.45, yoffset + 2.6))--, + --fmt("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.75), + --fmt("image", xoffset + 4.45, yoffset + 3.75, 1, 1, PNG.trash)) + if core.is_creative_enabled(name) then + fs(fmt("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.75), + fmt("image", xoffset + 4.45, yoffset + 3.75, 1, 1, PNG.trash)) + end local yextra = 5.4 local bag_equip = data.equip == "bag" @@ -2334,11 +2338,12 @@ local function get_inventory_fs(player, data, fs) fs("scroll_container_end[]") local btn = { - {"trash", ES"Trash all items"}, + --{"trash", ES"Trash all items"}, {"sort_az", ES"Sort items (A-Z)"}, {"sort_za", ES"Sort items (Z-A)"}, {"compress", ES"Compress items"}, } + if core.is_creative_enabled(name) then table.insert(btn, 1, {"trash", ES"Trash all items"}) end for i, v in ipairs(btn) do local btn_name, tooltip = unpack(v) diff --git a/my_changes/gui/i3/notrash.patch b/my_changes/gui/i3/notrash.patch new file mode 100644 index 0000000..7e1b208 --- /dev/null +++ b/my_changes/gui/i3/notrash.patch @@ -0,0 +1,35 @@ +diff --git a/init.lua b/init.lua +index 811b5c6..a5f9a34 100644 +--- a/init.lua ++++ b/init.lua +@@ -1874,9 +1874,13 @@ local function get_ctn_content(fs, data, player, xoffset, yoffset, ctn_len, awar + + fs(fmt("list[current_player;craft;%f,%f;3,3;]", xoffset, yoffset + 1.45), + fmt("image", xoffset + 3.47, yoffset + 2.69, 0.85, 0.85, PNG.arrow), +- fmt("list[current_player;craftpreview;%f,%f;1,1;]", xoffset + 4.45, yoffset + 2.6), +- fmt("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.75), +- fmt("image", xoffset + 4.45, yoffset + 3.75, 1, 1, PNG.trash)) ++ fmt("list[current_player;craftpreview;%f,%f;1,1;]", xoffset + 4.45, yoffset + 2.6))--, ++ --fmt("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.75), ++ --fmt("image", xoffset + 4.45, yoffset + 3.75, 1, 1, PNG.trash)) ++ if core.is_creative_enabled(name) then ++ fs(fmt("list[detached:i3_trash;main;%f,%f;1,1;]", xoffset + 4.45, yoffset + 3.75), ++ fmt("image", xoffset + 4.45, yoffset + 3.75, 1, 1, PNG.trash)) ++ end + + local yextra = 5.4 + local bag_equip = data.equip == "bag" +@@ -2334,11 +2338,12 @@ local function get_inventory_fs(player, data, fs) + fs("scroll_container_end[]") + + local btn = { +- {"trash", ES"Trash all items"}, ++ --{"trash", ES"Trash all items"}, + {"sort_az", ES"Sort items (A-Z)"}, + {"sort_za", ES"Sort items (Z-A)"}, + {"compress", ES"Compress items"}, + } ++ if core.is_creative_enabled(name) then table.insert(btn, 1, {"trash", ES"Trash all items"}) end + + for i, v in ipairs(btn) do + local btn_name, tooltip = unpack(v)