updated depreciated calls.

master
NathanSalapat 2019-02-02 15:34:26 -06:00
parent 7c8fa01596
commit 36b813bd76
7 changed files with 33 additions and 18 deletions

View File

@ -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'})

View File

@ -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

View File

@ -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
})

View File

@ -1 +1,3 @@
name = survival
description = Adds several survival related items.
depends = farming, default, wool, beds, thirsty

View File

@ -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

View File

@ -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}
})

View File

@ -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