From cd17b8d38e4a295d4d74d0428d45a728062e2001 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Thu, 14 May 2020 02:21:50 +0200 Subject: [PATCH] Show HUD success only in singleplayer mode --- init.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 5b3b0c3..6caf7a6 100644 --- a/init.lua +++ b/init.lua @@ -7,7 +7,6 @@ local searches = {} local recipes_cache = {} local usages_cache = {} local fuel_cache = {} - local toolrepair local progressive_mode = core.settings:get_bool "craftguide_progressive_mode" @@ -16,6 +15,7 @@ local autocache = core.settings:get_bool "craftguide_autocache" local http = core.request_http_api() local storage = core.get_mod_storage() +local singleplayer = core.is_singleplayer() local reg_items = core.registered_items local reg_tools = core.registered_tools @@ -1726,7 +1726,12 @@ else paramtype = "light", paramtype2 = "wallmounted", sunlight_propagates = true, - groups = {choppy = 1, attached_node = 1, oddly_breakable_by_hand = 1, flammable = 3}, + groups = { + choppy = 1, + attached_node = 1, + oddly_breakable_by_hand = 1, + flammable = 3, + }, node_box = { type = "wallmounted", wall_top = {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5}, @@ -1771,7 +1776,7 @@ else if rawget(_G, "sfinv_buttons") then sfinv_buttons.register_button("craftguide", { title = S"Crafting Guide", - tooltip = S"Shows a list of available crafting recipes, cooking recipes and fuels", + tooltip = S"Shows a list of available crafting recipes", image = PNG.book, action = function(player) on_use(player) @@ -1955,7 +1960,7 @@ if progressive_mode then local name = player:get_player_name() local data = pdata[name] - if data.show_hud ~= nil then + if data.show_hud ~= nil and singleplayer then show_hud_success(player, data) end end @@ -1971,6 +1976,8 @@ if progressive_mode then data.inv_items = dslz(meta:get_string "inv_items") or {} data.known_recipes = dslz(meta:get_string "known_recipes") or 0 + if not singleplayer then return end + data.hud = { bg = player:hud_add{ hud_elem_type = "image",