master
ExeVirus 2020-12-07 23:41:27 -05:00
parent f744c80dd4
commit 0753b3a5ed
5 changed files with 58 additions and 15 deletions

View File

@ -1,17 +1,34 @@
-- CHAT COMMANDS
if adv_core.setting("enable_chat_commands",true) then
minetest.register_chatcommand("make_shop", {
params = "<name> <privilege>",
description = "Generate an Adventure Shop Node",
privs = {interact = true},
func = function(name)
return true, "You said"
end,
})
if adv_core.setting("enable_adventure_shop_chat",true) then
minetest.register_chatcommand("shop", {
params = "<name> <privilege>",
description = "Browse the Adventure Shop",
privs = {interact = true},
func = function(name)
minetest.show_formspec(name, "adventure_core:store", adv_core.store_formspec(name, 1, "", ""))
return true
end,
})
end
if adv_core.setting("enable_adventure_shop_chat_build",true) then
minetest.register_chatcommand("make_shop", {
params = "<name> <privilege>",
description = "Generate the Adventure Shop",
privs = {interact = true},
func = function(name)
return true
end,
})
end
minetest.register_chatcommand("pouch", {
params = "<name> <privilege>",

View File

@ -111,8 +111,28 @@ end
function adv_core.store_formspec(name, page, search, selected)
--how to sort:
--https://stackoverflow.com/questions/17436947/how-to-iterate-through-table-in-lua
-- Display Pouch, left side panel
-- Search bar, middle-bottom of right half
local formspec = {
"formspec_version[3]",
"size[16,12]",
"position[0.5,0.5]",
"anchor[0.5,0.5]",
"no_prepend[]",
--background
"bgcolor[#866f4c;both;#00000080]",
"box[0.2,0.2;15.6,11.6;#dec29cFF]",
--pouch
"box[0.3,2.4;0.6,6.6;#564222FF]",
"image[0.4,2.6;0.4,0.4;pouch.png]",
"image[0.35,3.2;0.5,0.5;fire.png]",
"image[0.35,4.6;0.5,0.5;water.png]",
"image[0.35,6.0;0.5,0.5;earth.png]",
"image[0.35,7.4;0.5,0.5;air.png]",
--Search Bar
"field[10.0,10;4,0.6;search;;]",
"image_button[14.1,10;0.6,0.6;magnify.png;do_search;]",
"image_button[14.8,10;0.6,0.6;reset.png;do_search;]",
}
-- Reset Search, bottom right corner
-- Grid of options. right half
-- Paging arrows <->, middle left and right of right half
@ -130,7 +150,7 @@ function adv_core.store_formspec(name, page, search, selected)
-- else
--place in matched
-- end
return table.concat(formspec, "")
end
-- formspec callbacks

View File

@ -6,7 +6,13 @@ adventure_core.spawn_location (Spawn Location) v3f (0.0, 0.0, 0.0)
#Enable or disable craftability of adventure_shop
adventure_core.enable_adventure_shop (Craftable Adventure Shop) bool true
#Enable or disable chat_command usage
#Enable or disable the chat command for generating adventure_shop
adventure_core.enable_adventure_shop_chat_build (Chat Command Build Adventure Shop) bool true
#Enable or disable the chat command to browse shop directly
adventure_core.enable_adventure_shop_chat (Chat Command View Adventure Shop) bool false
#Enable or disable all non-prived chat_command usage
adventure_core.enable_chat_commands (Enable Chat Commands) bool true
#Spawn elements according to biome (if default is present) [random otherwise]

BIN
textures/magnify.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
textures/reset.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB