working sap collection.

master
NathanSalapat 2015-04-11 14:30:49 -05:00
parent 65b5e4730d
commit ac16c71958
3 changed files with 68 additions and 27 deletions

View File

@ -1,20 +1,28 @@
3-4-15:
Started mod, added cotton recipe. Uploaded to GitHub
4-11-15:
Spigots are working!!! They can only be placed on tree trunks, and need a bucket to collect sap. Right now you just have the infotexts to give you statuses. Placing a bucket in the spigot will trigger a timer that will replace the empty bucket with a sap filled bucket. Cook the sap filled bucket to get sugar. Collection and cooking times will probably be tweaked yet. I want to add a graphic to the spigot that shows whether the bucket is placed and is empty or full, but I don't know if I can do that without creating three nodes.
3-11-15:
Added Barrels.
4-9-15:
Spigots now only place on tree trunks, though they have to be on the ground, not one node above the ground, not sure why...
added the bucket with sap and recipe for making sugar and the energy bar.
3-17-15:
Added a few machetes and start working on the drinking part of the mod.
3-18-15:
Added a couple more machetes. Created the forum topic. Added five bugs, some are poisonous, so be careful.
3-25-15:
Started work on the two new "beds". Added beds as a dependency and am using that code for the time being to handle sleeping.
3-29-15:
Started working on the system for creating tree sap, and coding the options that only allow the spigot to be placed on a tree.
3-28-15:
Added an ABM that changes some sand near water to survival:sand_with_food, which, as the name suggests, can contain some oysters or mussels. Added the oyster and mussels, along with their craft recipes. I'm debating over whether I should allow eating them raw in shell, or if they should have to be crafted out of the shell to eat raw, but left in shell to cook.
3-29-15:
Started working on the system for creating tree sap, and coding the options that only allow the spigot to be placed on a tree.
3-25-15:
Started work on the two new "beds". Added beds as a dependency and am using that code for the time being to handle sleeping.
3-18-15:
Added a couple more machetes. Created the forum topic. Added five bugs, some are poisonous, so be careful.
3-17-15:
Added a few machetes and start working on the drinking part of the mod.
3-11-15:
Added Barrels.
3-4-15:
Started mod, added cotton recipe. Uploaded to GitHub

View File

@ -82,6 +82,15 @@ minetest.register_craft({
}
})
--[[minetest.register_craft({
output = 'survival:spigot 1',
recipe = {
{'', '', ''},
{'', '', ''},
{'', '', ''}
}
})]]
minetest.register_craft({
type = 'cooking',
output = 'survival:slug_cooked',

View File

@ -97,7 +97,7 @@ minetest.register_node('survival:spigot', {
mesh = 'spigot.obj',
tiles = {'default_cobble.png'},
-- inventory_image = 'placeholder.png',
groups = {choppy=2, dig_immediate=2, attached_node=1},
groups = {choppy=2, dig_immediate=2,},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = {
@ -108,17 +108,39 @@ minetest.register_node('survival:spigot', {
type = 'fixed',
fixed = {-.35, -.2, 0, .35, .5, .5}, -- Right, Bottom, Back, Left, Top, Front
},
--[[ Currently this code crashes the game, not sure why
on_construct = function(pos)
local meta = minetest.get_meta(pos)
-- local timer = minetest.get_node_timer(pos)
meta:set_size('bucket', 1)
meta:set_string('infotext', 'Needs a bucket to collect sap.')
meta:set_string('formspec', spigot_formspec)
local inv = meta.get_inventory()
inv:set_size('main', 1*1)
end,]]
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
inv:set_size('sap', 1)
meta:set_string("formspec",
"size[8,9]"..
"label[1,0;You need a bucket to collect sap.]" ..
"list[current_name;sap;1,1.5;1,1]"..
"list[current_player;main;0,5;8,4;]")
meta:set_string("infotext", "Sap Spigot")
end,
on_timer = function(pos, elapsed)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
local timer = minetest.get_node_timer(pos)
if inv:contains_item('sap', 'bucket:bucket_empty') then --make sure the bucket is still there
inv:set_stack('sap', 1,'survival:bucket_sap')
meta:set_string('infotext', 'bucket filled with sap, please replace.')
timer:stop()
return
end
end,
on_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
local timer = minetest.get_node_timer(pos)
if inv:contains_item('sap', 'bucket:bucket_empty') then
timer:start(60)
meta:set_string('infotext', 'gathering sap.. this could take a while.')
end
end,
after_place_node = function(pos, placer, itemstack)
local n = minetest.get_node(pos) --get the location of the placed node
if not n or not n.param2 then
@ -128,9 +150,11 @@ minetest.register_node('survival:spigot', {
local dir = minetest.facedir_to_dir(n.param2)
local p1 = {x=pos.x+dir.x, y=pos.y, z=pos.z+dir.z} --node placed on
local p2 = {x=pos.x+dir.x, y=pos.y+1, z=pos.z+dir.z} --node above previous
local p3 = {x=pos.x+dir.x, y=pos.y-1, z=pos.z+dir.z} --node below first
local n2 = minetest.get_node_or_nil(p1)
local n3 = minetest.get_node_or_nil(p2)
if n2.name and n3.name ~= 'default:tree' then
local n4 = minetest.get_node_or_nil(p3)
if n2.name and n3.name and n4.name ~= 'default:tree' then
minetest.remove_node(pos)
return true
--TODO make the spigot place one node above the ground.