Fix formspecs on games other than minetest_game
This commit is contained in:
parent
807283b262
commit
c6322b49c4
17
atm-core.lua
17
atm-core.lua
|
@ -12,12 +12,13 @@ end
|
||||||
|
|
||||||
local formspecs = {}
|
local formspecs = {}
|
||||||
|
|
||||||
|
lurkcoin.formspec_prepend = 'style_type[image_button;bgimg=;bgimg_pressed=]'
|
||||||
|
|
||||||
-- 0.4 compatibility
|
-- 0.4 compatibility
|
||||||
lurkcoin.formspec_prepend = ''
|
|
||||||
if minetest.global_exists('default') and default.gui_bg and
|
if minetest.global_exists('default') and default.gui_bg and
|
||||||
default.gui_bg_img and default.gui_slots then
|
default.gui_bg_img and default.gui_slots then
|
||||||
lurkcoin.formspec_prepend = default.gui_bg .. default.gui_bg_img ..
|
lurkcoin.formspec_prepend = default.gui_bg .. default.gui_bg_img ..
|
||||||
default.gui_slots
|
default.gui_slots .. lurkcoin.formspec_prepend
|
||||||
end
|
end
|
||||||
|
|
||||||
local function centre_label(pos, label)
|
local function centre_label(pos, label)
|
||||||
|
@ -25,6 +26,14 @@ local function centre_label(pos, label)
|
||||||
';true;false;]'
|
';true;false;]'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local formspec_img = 'blank.png'
|
||||||
|
if minetest.registered_items['default:mese_crystal'] then
|
||||||
|
formspec_img = 'default_mese_crystal.png'
|
||||||
|
elseif minetest.registered_items['default:gold_ingot'] or
|
||||||
|
minetest.registered_items['mcl_core:gold_ingot'] then
|
||||||
|
formspec_img = 'default_gold_ingot.png'
|
||||||
|
end
|
||||||
|
|
||||||
-- The formspec code is based on something I did in 2017(?) for lurkcoinV1,
|
-- The formspec code is based on something I did in 2017(?) for lurkcoinV1,
|
||||||
-- formspecs are weird and I somehow got it right then.
|
-- formspecs are weird and I somehow got it right then.
|
||||||
local function get_formspec(name, page, params)
|
local function get_formspec(name, page, params)
|
||||||
|
@ -37,8 +46,8 @@ local function get_formspec(name, page, params)
|
||||||
'label[0.5,2.25;Exchange rate: \194\1641.00 is equal to ' ..
|
'label[0.5,2.25;Exchange rate: \194\1641.00 is equal to ' ..
|
||||||
e(lurkcoin.exchange_rate) .. 'cr.]' ..
|
e(lurkcoin.exchange_rate) .. 'cr.]' ..
|
||||||
centre_label('1.75,1.05;4.5,0.5', 'Your account: ' .. name) ..
|
centre_label('1.75,1.05;4.5,0.5', 'Your account: ' .. name) ..
|
||||||
'image[0.5,0.5;1,1;default_mese_crystal.png]' ..
|
'image[0.5,0.5;1,1;' .. formspec_img .. ']' ..
|
||||||
'image[6.5,0.5;1,1;default_mese_crystal.png]'
|
'image[6.5,0.5;1,1;' .. formspec_img .. ']'
|
||||||
|
|
||||||
-- Get the page formspec
|
-- Get the page formspec
|
||||||
page = formspecs[page] or formspecs.main
|
page = formspecs[page] or formspecs.main
|
||||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,2 +1,2 @@
|
||||||
name = lurkcoin
|
name = lurkcoin
|
||||||
optional_depends = atm,bank_accounts,cloaking,currency,default,economy,money,money2
|
optional_depends = atm,bank_accounts,cloaking,currency,default,economy,mcl_core,money,money2
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 694 B After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 781 B After Width: | Height: | Size: 2.9 KiB |
Loading…
Reference in New Issue