diff --git a/abms.lua b/abms.lua index 3f6a250..aedf33c 100644 --- a/abms.lua +++ b/abms.lua @@ -6,7 +6,7 @@ minetest.register_abm({ action = function(pos, node) local name = minetest.get_node(pos).name if name == "default:sand" then - if minetest.find_node_near(pos, 3, {"group:water"}) == nil then + if minetest.find_node_near(pos, 3, {"survival:sand_with_food"}) ~= nil then return end minetest.set_node(pos, {name='survival:sand_with_food'}) diff --git a/changelog.txt b/changelog.txt index 1f833b6..3f34b92 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +2-01-19: +Adds support for the bronze canteen. +Restricted the amount of the sand_with_food the ABM will place. +Updated some depreciated code calls. + 5-11-15: Removed the drinking parts of code, the thirsty mod does a great job, just use that if you want drinking. Updated the readme and cleaned up stray print code from debugging. @@ -10,7 +15,7 @@ Wells added, they require a hole in the ground three nodes deep to be placed on 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. Updated the spigot model and texture. -Crafting recipe is +Crafting recipe is c cs c s where c is clay and s is group stick diff --git a/foods.lua b/foods.lua index 2636d1d..d7c671e 100644 --- a/foods.lua +++ b/foods.lua @@ -1,10 +1,10 @@ minetest.register_craftitem('survival:slug_raw', { description = 'slug', inventory_image = 'survival_slug_raw.png', - on_use = function(player) + on_use = function(itemstack, user, pointed_thing) local hp_gain = math.random(-4,1) - local hp = player:get_hp() - player:set_hp(hp + hp_gain) + local eat_func = minetest.item_eat(hg_gain) + return eat_func(itemstack, user, pointed_thing) end }) diff --git a/mod.conf b/mod.conf index c3182d2..157a4ff 100644 --- a/mod.conf +++ b/mod.conf @@ -1 +1,3 @@ name = survival +description = Adds several survival related items. +depends = farming, default, wool, beds, thirsty diff --git a/nodes.lua b/nodes.lua index ef7c4c2..bbb9a06 100644 --- a/nodes.lua +++ b/nodes.lua @@ -92,7 +92,7 @@ minetest.register_node('survival:spigot', { fixed = {-.35, -.2, 0, .35, .5, .5}, -- Right, Bottom, Back, Left, Top, Front }, on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() inv:set_size('main', 8*4) inv:set_size('sap', 1) @@ -104,7 +104,7 @@ minetest.register_node('survival:spigot', { meta:set_string('infotext', 'Sap Spigot') end, on_timer = function(pos, elapsed) - local meta = minetest.env:get_meta(pos) + local meta = minetest.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 @@ -115,7 +115,7 @@ minetest.register_node('survival:spigot', { end end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local timer = minetest.get_node_timer(pos) if inv:contains_item('sap', 'bucket:bucket_empty') then @@ -125,7 +125,7 @@ minetest.register_node('survival:spigot', { end, on_metadata_inventory_take = function(pos, listname, index, stack, player) local timer = minetest.get_node_timer(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string('infotext', 'You need a bucket to collect sap.') end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) @@ -317,7 +317,7 @@ minetest.register_node('survival:well_bottom', { end minetest.set_node(pos,{name = 'air'}) minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z},{name = 'survival:well_bottom', param2=n.param2}) - + end, }) @@ -349,7 +349,7 @@ minetest.register_node('survival:well_top', { end end, on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() inv:set_size('main', 8*4) inv:set_size('pail', 1) @@ -361,7 +361,7 @@ minetest.register_node('survival:well_top', { meta:set_string('infotext', 'Well') end, on_timer = function(pos, elapsed) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local timer = minetest.get_node_timer(pos) if inv:contains_item('pail', 'bucket:bucket_empty') then --make sure the bucket is still there @@ -372,23 +372,29 @@ minetest.register_node('survival:well_top', { inv:set_stack('pail', 1,({name='thirsty:steel_canteen', wear=1,})) timer:stop() return + elseif inv:contains_item('pail', 'thirsty:bronze_canteen') then --make sure the canteen is still there + inv:set_stack('pail', 1,({name='thirsty:bronze_canteen', wear=1,})) + timer:stop() + return end end, on_metadata_inventory_put = function(pos, listname, index, stack, player) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local timer = minetest.get_node_timer(pos) if inv:contains_item('pail', 'bucket:bucket_empty') then timer:start(7) elseif inv:contains_item('pail', 'thirsty:steel_canteen') then timer:start(6) + elseif inv:contains_item('pail', 'thirsty:bronze_canteen') then + timer:start(10) end end, on_metadata_inventory_take = function(pos, listname, index, stack, player) local chance = math.random(1,2) if chance == 2 then -- Let's change the formspec' - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) local inv = meta:get_inventory() inv:set_size('main', 8*4) inv:set_size('pail', 0) @@ -409,6 +415,8 @@ minetest.register_node('survival:well_top', { return 1 elseif stack:get_name() == ('thirsty:steel_canteen') then return 1 + elseif stack:get_name() == ('thirsty:bronze_canteen') then + return 1 else return 0 end diff --git a/ores.lua b/ores.lua index bd33852..0d0c4ed 100644 --- a/ores.lua +++ b/ores.lua @@ -3,7 +3,7 @@ minetest.register_ore({ ore = 'survival:stone_with_salt', wherein = 'default:stone', clust_size = 6, - height_min = -3100, - height_max = 200, - noise_params = {offset=0, scale=7, spread={x=250, y=250, z=250}, seed=23, octaves=6, persist=0.70} + y_min = -3100, + y_max = 200, + noise_params = {offset=0, scale=7, spread={x=250, y=250, z=250}, seed=23, octaves=6, persist=0.70} }) diff --git a/readme.md b/readme.md index 196508c..7810dfc 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Nathan # Survival -This is a Minetest mod that adds survival related items +Adds several survival related items. ## Forum Topic https://forum.minetest.net/viewtopic.php?f=9&t=11517