mirror of
https://github.com/Dragonop/claycrafter.git
synced 2024-11-26 09:13:51 +01:00
Vessels inv
Vessels inv now works, more room in dst.
This commit is contained in:
parent
ff87677ae5
commit
2c68b350be
@ -14,14 +14,16 @@ local function active_formspec(fuel_percent, item_percent)
|
|||||||
(100-fuel_percent)..":claycrafter_claycrafter_water_fg.png]"..
|
(100-fuel_percent)..":claycrafter_claycrafter_water_fg.png]"..
|
||||||
"image[3.75,1.5;1,1;gui_claycrafter_arrow_bg.png^[lowpart:"..
|
"image[3.75,1.5;1,1;gui_claycrafter_arrow_bg.png^[lowpart:"..
|
||||||
(item_percent)..":gui_claycrafter_arrow_fg.png^[transformR270]"..
|
(item_percent)..":gui_claycrafter_arrow_fg.png^[transformR270]"..
|
||||||
"list[current_name;dst;4.75,0.96;2,2;]"..
|
"list[current_name;dst;4.75,0.96;3,2;]"..
|
||||||
"list[current_name;vessels;1,1;2,2;]"..
|
"list[current_name;vessels;0,1.5;2,2;]"..
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
"listring[current_name;dst]"..
|
"listring[current_name;dst]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[current_name;src]"..
|
"listring[current_name;src]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
|
"listring[current_name;vessels]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
default.get_hotbar_bg(0, 4.25)
|
default.get_hotbar_bg(0, 4.25)
|
||||||
return formspec
|
return formspec
|
||||||
end
|
end
|
||||||
@ -35,14 +37,16 @@ local inactive_formspec =
|
|||||||
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
"list[current_name;fuel;2.75,2.5;1,1;]"..
|
||||||
"image[2.75,1.5;1,1;claycrafter_claycrafter_water_bg.png]"..
|
"image[2.75,1.5;1,1;claycrafter_claycrafter_water_bg.png]"..
|
||||||
"image[3.75,1.5;1,1;gui_claycrafter_arrow_bg.png^[transformR270]"..
|
"image[3.75,1.5;1,1;gui_claycrafter_arrow_bg.png^[transformR270]"..
|
||||||
"list[current_name;dst;4.75,0.96;2,2;]"..
|
"list[current_name;dst;4.75,0.96;3,2;]"..
|
||||||
"list[current_name;vessels;1,1;2,2;]"..
|
"list[current_name;vessels;0,1.5;2,2;]"..
|
||||||
"list[current_player;main;0,4.25;8,1;]"..
|
"list[current_player;main;0,4.25;8,1;]"..
|
||||||
"list[current_player;main;0,5.5;8,3;8]"..
|
"list[current_player;main;0,5.5;8,3;8]"..
|
||||||
"listring[current_name;dst]"..
|
"listring[current_name;dst]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
"listring[current_name;src]"..
|
"listring[current_name;src]"..
|
||||||
"listring[current_player;main]"..
|
"listring[current_player;main]"..
|
||||||
|
"listring[current_name;vessels]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
default.get_hotbar_bg(0, 4.25)
|
default.get_hotbar_bg(0, 4.25)
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -52,7 +56,7 @@ local inactive_formspec =
|
|||||||
local function can_dig(pos, player)
|
local function can_dig(pos, player)
|
||||||
local meta = minetest.get_meta(pos);
|
local meta = minetest.get_meta(pos);
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src")
|
return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src") and inv:is_empty("vessels")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
@ -182,7 +186,7 @@ minetest.register_abm({
|
|||||||
for listname, size in pairs({
|
for listname, size in pairs({
|
||||||
src = 1,
|
src = 1,
|
||||||
fuel = 1,
|
fuel = 1,
|
||||||
dst = 4,
|
dst = 6,
|
||||||
vessels = 4
|
vessels = 4
|
||||||
}) do
|
}) do
|
||||||
if inv:get_size(listname) ~= size then
|
if inv:get_size(listname) ~= size then
|
||||||
@ -213,11 +217,14 @@ minetest.register_abm({
|
|||||||
src_time = src_time + 1
|
src_time = src_time + 1
|
||||||
if src_time >= cooktime then
|
if src_time >= cooktime then
|
||||||
-- Place result in dst list if possible
|
-- Place result in dst list if possible
|
||||||
if inv:room_for_item("dst", ItemStack({name = "default:clay", count = 4})) and inv:room_for_item("dst", ItemStack({name = "vessels:drinking_glass"})) then
|
if inv:room_for_item("dst", ItemStack({name = "default:clay", count = 4}))
|
||||||
print("Apparently, there's room.")
|
and inv:room_for_item("vessels", ItemStack({name = "vessels:drinking_glass"}))
|
||||||
|
then
|
||||||
inv:add_item("dst", {name = "default:clay", count = 4})
|
inv:add_item("dst", {name = "default:clay", count = 4})
|
||||||
inv:remove_item("src", inv:get_stack("src", 1):get_name())
|
inv:remove_item("src", inv:get_stack("src", 1):get_name())
|
||||||
src_time = 0
|
src_time = 0
|
||||||
|
else
|
||||||
|
swap_node(pos, "claycrafter:claycrafter")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -235,9 +242,13 @@ minetest.register_abm({
|
|||||||
else
|
else
|
||||||
-- Take fuel from fuel list
|
-- Take fuel from fuel list
|
||||||
|
|
||||||
if inv:room_for_item("dst", ItemStack({name = "vessels:drinking_glass"})) and inv:room_for_item("dst", ItemStack({name = "default:clay", count = 4})) then
|
if inv:room_for_item("dst", ItemStack({name = "default:clay", count = 4}))
|
||||||
|
and inv:room_for_item("vessels", ItemStack({name = "vessels:drinking_glass"}))
|
||||||
|
then
|
||||||
inv:remove_item("fuel", inv:get_stack("fuel", 1):get_name())
|
inv:remove_item("fuel", inv:get_stack("fuel", 1):get_name())
|
||||||
inv:add_item("dst", {name = "vessels:drinking_glass"})
|
inv:add_item("vessels", {name = "vessels:drinking_glass"})
|
||||||
|
else
|
||||||
|
swap_node(pos, "claycrafter:claycrafter_active")
|
||||||
end
|
end
|
||||||
|
|
||||||
fuel_totaltime = fueltime
|
fuel_totaltime = fueltime
|
||||||
|
5
glass_of_water.lua
Normal file
5
glass_of_water.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
minetest.register_craftitem("claycrafter:glass_of_water", {
|
||||||
|
description = "Glass of Water",
|
||||||
|
inventory_image = "claycrafter_glass_of_water.png",
|
||||||
|
groups = {h2o = 1, vessel = 1}, -- How much time to convert 1 compressed dirt to 4 clay
|
||||||
|
})
|
10
init.lua
10
init.lua
@ -4,7 +4,7 @@ minetest.register_node("claycrafter:compressed_dirt", {
|
|||||||
tiles = {"claycrafter_compressed_dirt.png"},
|
tiles = {"claycrafter_compressed_dirt.png"},
|
||||||
groups = {crumbly = 1, oddly_breakable_by_hand = 1}
|
groups = {crumbly = 1, oddly_breakable_by_hand = 1}
|
||||||
})
|
})
|
||||||
|
-- Crafts
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "claycrafter:compressed_dirt",
|
output = "claycrafter:compressed_dirt",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -14,13 +14,6 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
--Glass of water
|
|
||||||
minetest.register_craftitem("claycrafter:glass_of_water", {
|
|
||||||
description = "Glass of Water",
|
|
||||||
inventory_image = "claycrafter_glass_of_water.png",
|
|
||||||
groups = {h2o = 1, vessel = 1}, -- How much time to convert 1 compressed dirt to 4 clay
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "claycrafter:glass_of_water 8",
|
output = "claycrafter:glass_of_water 8",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -44,3 +37,4 @@ minetest.register_craft({
|
|||||||
|
|
||||||
|
|
||||||
dofile(minetest.get_modpath("claycrafter") .. "/claycrafter.lua")
|
dofile(minetest.get_modpath("claycrafter") .. "/claycrafter.lua")
|
||||||
|
dofile(minetest.get_modpath("claycrafter") .. "/glass_of_water.lua")
|
Loading…
Reference in New Issue
Block a user