Skip to content

Commit

Permalink
test: make greater use of spys and stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazerbeak12345 committed Aug 6, 2024
1 parent 4b3dbac commit 990bc3b
Show file tree
Hide file tree
Showing 4 changed files with 543 additions and 669 deletions.
26 changes: 22 additions & 4 deletions api.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
local minetest, dump, flow, sway, flow_extras = minetest, dump, flow, sway, flow_extras
sway.pages = {}
sway.pages_ordered = {}
_G.sway = {
pages = {},
pages_ordered = {},
enabled = true,
}
local contexts = {}
sway.enabled = true
local gui = flow.widgets

-- TODO: use fake tabheader
Expand Down Expand Up @@ -294,3 +295,20 @@ end)
minetest.register_on_leaveplayer(function(player)
sway.set_context(player)
end)

minetest.register_on_mods_loaded(function()
-- Before we do anything, disable sfinv, unified_inventory, and i3. (code from i3 at commit bd5ea4e6). Also under MIT,
-- under Jean-Patrick-Guerrero and contributors. Modified to fit my style guidelines, and to also disable i3
if minetest.global_exists"sfinv" then
function sfinv.set_player_inventory_formspec() end
sfinv.enabled = false
end
if minetest.global_exists"unified_inventory" then
function unified_inventory.set_inventory_formspec() end
end
assert(
not minetest.global_exists"i3",
"\n\n\t\t\tFATAL: Unlike all other inventory mods, is impossible to automatically disable i3, so you must do it "
.. "yourself.\n"
)
end)
2 changes: 0 additions & 2 deletions crafting.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local minetest, sway, flow, flow_extras = minetest, sway, flow, flow_extras

-- Load support for MT game translation.
local S = minetest.get_translator("sway")

Expand Down
20 changes: 0 additions & 20 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,6 @@ print[[
]]
-- See README.md for art credit

local minetest = minetest
sway = {}

minetest.register_on_mods_loaded(function()
-- Before we do anything, disable sfinv, unified_inventory, and i3. (code from i3 at commit bd5ea4e6). Also under MIT,
-- under Jean-Patrick-Guerrero and contributors. Modified to fit my style guidelines, and to also disable i3
if minetest.global_exists"sfinv" then
function sfinv.set_player_inventory_formspec() end
sfinv.enabled = false
end
if minetest.global_exists"unified_inventory" then
function unified_inventory.set_inventory_formspec() end
end
assert(
not minetest.global_exists"i3",
"\n\n\t\t\tFATAL: Unlike all other inventory mods, is impossible to automatically disable i3, so you must do it "
.. "yourself.\n"
)
end)

local modpath = minetest.get_modpath"sway"
dofile(modpath .. "/api.lua")
dofile(modpath .. "/crafting.lua")
Loading

0 comments on commit 990bc3b

Please sign in to comment.