4
This commit is contained in:
parent
723e1068e4
commit
a87a784e41
@ -1,3 +0,0 @@
|
||||
default
|
||||
sfinv
|
||||
3d_armor?
|
@ -1,72 +0,0 @@
|
||||
local show_armor = minetest.get_modpath("3d_armor")
|
||||
|
||||
local function item_drop(itemstack, dropper, pos)
|
||||
if dropper:is_player() then
|
||||
local v = dropper:get_look_dir()
|
||||
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
||||
p.x = p.x+(math.random(1,3)*0.2)
|
||||
p.z = p.z+(math.random(1,3)*0.2)
|
||||
local obj = minetest.env:add_item(p, itemstack)
|
||||
if obj then
|
||||
v.x = v.x*4
|
||||
v.y = v.y*4 + 2
|
||||
v.z = v.z*4
|
||||
obj:setvelocity(v)
|
||||
end
|
||||
else
|
||||
minetest.add_item(pos, itemstack)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
local function drop_fields(player, name)
|
||||
local inv = player:get_inventory()
|
||||
for i,stack in ipairs(inv:get_list(name)) do
|
||||
item_drop(stack, player, player:get_pos())
|
||||
stack:clear()
|
||||
inv:set_stack(name, i, stack)
|
||||
end
|
||||
end
|
||||
|
||||
sfinv.override_page("sfinv:crafting", {
|
||||
title = "Crafting",
|
||||
get = function(self, player, context)
|
||||
local form = [[
|
||||
background[-0.19,-0.25;9.41,9.49;crafting_gui_formbg.png]
|
||||
listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]
|
||||
list[current_player;craft;4,1;2,1;1]
|
||||
list[current_player;craft;4,2;2,1;4]
|
||||
list[current_player;craftpreview;7.05,1.54;1,1;]
|
||||
list[detached:split;main;7.99,3.15;1,1;]
|
||||
image[1.5,0;2,4;default_player2d.png]
|
||||
image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true]
|
||||
]]
|
||||
if show_armor then
|
||||
local player_name = player:get_player_name()
|
||||
form = form ..
|
||||
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
|
||||
end
|
||||
return sfinv.make_formspec(player, context, form, true)
|
||||
end,
|
||||
on_player_receive_fields = function(self, player, context, fields)
|
||||
if fields.quit then
|
||||
drop_fields(player, "craft")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local split_inv = minetest.create_detached_inventory("split", {
|
||||
allow_move = function(_, _, _, _, _, count, _)
|
||||
return count
|
||||
end,
|
||||
allow_put = function(_, _, _, stack, _)
|
||||
return stack:get_count() / 2
|
||||
end,
|
||||
allow_take = function(_, _, _, stack, _)
|
||||
return stack:get_count()
|
||||
end,
|
||||
})
|
||||
split_inv:set_size("main", 1)
|
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB |
@ -1,7 +1,7 @@
|
||||
default.chest_formspec =
|
||||
"size[9,9.75]"..
|
||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;formspec_chest.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"list[current_name;main;0,0.5;9,4;]"..
|
||||
@ -23,7 +23,7 @@ function default.get_locked_chest_formspec(pos)
|
||||
local formspec =
|
||||
"size[9,9.75]"..
|
||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;crafting_inventory_chest.png]"..
|
||||
"background[-0.19,-0.25;9.41,10.48;formspec_chest.png]"..
|
||||
"bgcolor[#080808BB;true]"..
|
||||
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||
"list[nodemeta:".. spos .. ";main;0,0.5;9,4;]"..
|
||||
|
@ -22,13 +22,10 @@ dofile(minetest.get_modpath("default").."/furnace.lua")
|
||||
dofile(minetest.get_modpath("default").."/workbench.lua")
|
||||
dofile(minetest.get_modpath("default").."/chest.lua")
|
||||
|
||||
minetest.register_on_newplayer(function (player)
|
||||
player:get_inventory():add_item('main', 'default:sword_steel')
|
||||
player:get_inventory():add_item('main', 'default:torch 8')
|
||||
player:get_inventory():add_item('main', 'default:wood 64')
|
||||
end)
|
||||
|
||||
-- GUI related stuff
|
||||
default.gui_bg = "bgcolor[#080808BB;true]"
|
||||
default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]"
|
||||
default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]"
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
minetest.register_on_newplayer(function (player)
|
||||
player:get_inventory():add_item('main', 'default:sword_steel')
|
||||
player:get_inventory():add_item('main', 'default:torch 8')
|
||||
player:get_inventory():add_item('main', 'default:wood 64')
|
||||
end)
|
||||
end
|
||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@ -146,7 +146,7 @@ local function fill_chest(pos)
|
||||
if n and n.name and n.name == "default:chest" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
--inv:set_size("main", 8*4)
|
||||
for i,v in ipairs(dungeon_loot.loot_types) do
|
||||
local item, num = get_item_and_amount(v,pos.y)
|
||||
if item then
|
||||
|
@ -22,7 +22,7 @@ local function create_detached_inventory(id)
|
||||
return count
|
||||
end,
|
||||
})
|
||||
inv:set_size("main", 32)
|
||||
--inv:set_size("main", 32)
|
||||
return inv
|
||||
end
|
||||
|
||||
|
@ -63,7 +63,7 @@ function sfinv.make_formspec(player, context, content, show_inv, size)
|
||||
end
|
||||
|
||||
function sfinv.get_homepage_name(player)
|
||||
return "sfinv:crafting"
|
||||
return "sfinv:inventory"
|
||||
end
|
||||
|
||||
function sfinv.get_formspec(player, context)
|
||||
|
@ -1,7 +1,7 @@
|
||||
dofile(minetest.get_modpath("sfinv") .. "/api.lua")
|
||||
|
||||
sfinv.register_page("sfinv:crafting", {
|
||||
title = "Crafting",
|
||||
sfinv.register_page("sfinv:inventory", {
|
||||
title = "Inventory",
|
||||
get = function(self, player, context)
|
||||
return sfinv.make_formspec(player, context, [[
|
||||
list[current_player;craft;1.75,0.5;3,3;]
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB |
Loading…
x
Reference in New Issue
Block a user