Compare commits
5 Commits
add18abe65
...
b7be1b5de0
Author | SHA1 | Date |
---|---|---|
Nathan Salapat | b7be1b5de0 | |
farfadet46 | f1b4b79dfe | |
NathanSalapat | 36b813bd76 | |
NathanSalapat | 7c8fa01596 | |
NathanSalapat | be7c8cb16b |
2
abms.lua
2
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'})
|
||||
|
|
|
@ -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
|
||||
|
|
10
crafting.lua
10
crafting.lua
|
@ -74,8 +74,8 @@ minetest.register_craft({
|
|||
minetest.register_craft({
|
||||
output = 'survival:leafy_bed 1',
|
||||
recipe = {
|
||||
{'default:leaves', '', 'default:leaves'},
|
||||
{'default:leaves', 'default:leaves', 'default:leaves'}
|
||||
{'group:leaves', '', 'group:leaves'},
|
||||
{'group:leaves', 'group:leaves', 'group:leaves'}
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -124,6 +124,12 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'shapeless',
|
||||
output = 'survival:salt 9',
|
||||
recipe = {'survival:salt_lump'}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'cooking',
|
||||
output = 'survival:slug_cooked',
|
||||
|
|
|
@ -9,3 +9,12 @@ minetest.register_craftitem('survival:bucket_sap', {
|
|||
stack_max = 1,
|
||||
})
|
||||
|
||||
minetest.register_craftitem('survival:salt_lump', {
|
||||
description = 'chunk of salt',
|
||||
inventory_image = 'survival_salt_lump.png'
|
||||
})
|
||||
|
||||
minetest.register_craftitem('survival:salt', {
|
||||
description = 'salt',
|
||||
inventory_image = 'survival_salt.png'
|
||||
})
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Code and graphics by Nathan.
|
|
@ -2,4 +2,4 @@ farming
|
|||
default
|
||||
wool
|
||||
beds
|
||||
thirsty?
|
||||
thirsty
|
||||
|
|
55
foods.lua
55
foods.lua
|
@ -1,37 +1,31 @@
|
|||
minetest.register_craftitem('survival:energy_bar', {
|
||||
description = 'energy bar',
|
||||
inventory_image = 'survival_energy_bar.png',
|
||||
on_use = minetest.item_eat(10)
|
||||
--should add some thirst.
|
||||
})
|
||||
|
||||
minetest.register_craftitem('survival:slug_raw', {
|
||||
description = 'slug',
|
||||
inventory_image = 'survival_slug_raw.png',
|
||||
on_use = function(pos, 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
|
||||
})
|
||||
|
||||
local food_table = { --craft, desc, invimg, health
|
||||
{'slug_cooked', 'cooked slug', 'slug_cooked', .25},
|
||||
{'cricket_raw', 'cricket', 'cricket_raw', .25},
|
||||
{'cricket_cooked', 'cooked cricket', 'cricket_cooked', .125},
|
||||
{'worm_raw', 'worm', 'worm_raw', .25},
|
||||
{'worm_cooked', 'cooked worm', 'worm_cooked', .125},
|
||||
{'centipede_raw', 'centipede', 'centipede_raw', .25},
|
||||
{'centipede_cooked', 'cooked centipede', 'centipede_cooked', .25},
|
||||
{'milipede_raw', 'milipede', 'milipede_raw', -4},
|
||||
{'milipede_cooked', 'cooked milipede', 'milipede_cooked', -3},
|
||||
{'oyster_raw', 'raw oyster', 'oyster_raw', .5},
|
||||
{'oyster_cooked', 'cooked oyster', 'oyster_cooked', .6},
|
||||
{'mussel_raw', 'raw mussel', 'mussel_raw', -.7},
|
||||
{'mussel_cooked', 'cooked mussel', 'mussel_cooked', .6},
|
||||
{'sugar', 'sugar', 'sugar', .1},
|
||||
{'raw_kabob', 'uncooked seafood kabob', 'raw_kabob', 1},
|
||||
{'cooked_kabob', 'seafood kabob', 'cooked_kabob', 2.5}
|
||||
local food_table = { --craft, desc, invimg, health, hydration
|
||||
{'slug_cooked', 'cooked slug', 'slug_cooked', .25, .1},
|
||||
{'cricket_raw', 'cricket', 'cricket_raw', .25, .1},
|
||||
{'cricket_cooked', 'cooked cricket', 'cricket_cooked', .125, .125},
|
||||
{'worm_raw', 'worm', 'worm_raw', .25, .2},
|
||||
{'worm_cooked', 'cooked worm', 'worm_cooked', .125, .1},
|
||||
{'centipede_raw', 'centipede', 'centipede_raw', .25, .15},
|
||||
{'centipede_cooked', 'cooked centipede', 'centipede_cooked', .25, .1},
|
||||
{'milipede_raw', 'milipede', 'milipede_raw', -4, .1},
|
||||
{'milipede_cooked', 'cooked milipede', 'milipede_cooked', -3, 0},
|
||||
{'oyster_raw', 'raw oyster', 'oyster_raw', .5, .45},
|
||||
{'oyster_cooked', 'cooked oyster', 'oyster_cooked', .6, .35},
|
||||
{'mussel_raw', 'raw mussel', 'mussel_raw', -.7, .6},
|
||||
{'mussel_cooked', 'cooked mussel', 'mussel_cooked', .6, .35},
|
||||
{'sugar', 'sugar', 'sugar', .1, -1},
|
||||
{'raw_kabob', 'uncooked seafood kabob', 'raw_kabob', 1, 1.5},
|
||||
{'cooked_kabob', 'seafood kabob', 'cooked_kabob', 2.5, 1},
|
||||
{'energy_bar', 'energy bar', 'energy_bar', 10, -4}
|
||||
}
|
||||
|
||||
for i in ipairs (food_table) do
|
||||
|
@ -39,10 +33,15 @@ for i in ipairs (food_table) do
|
|||
local desc = food_table[i][2]
|
||||
local invimg = food_table[i][3]
|
||||
local health = food_table[i][4]
|
||||
local hydration = food_table[i][5]
|
||||
|
||||
minetest.register_craftitem('survival:'..craft, {
|
||||
description = desc,
|
||||
inventory_image = 'survival_'..invimg..'.png',
|
||||
on_use = minetest.item_eat(health)
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
thirsty.drink(user, hydration, 20)
|
||||
local eat_func = minetest.item_eat(health)
|
||||
return eat_func(itemstack, user, pointed_thing)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
|
1
init.lua
1
init.lua
|
@ -6,3 +6,4 @@ dofile(minetest.get_modpath('survival')..'/foods.lua')
|
|||
dofile(minetest.get_modpath('survival')..'/abms.lua')
|
||||
dofile(minetest.get_modpath('survival')..'/craftitem.lua')
|
||||
dofile(minetest.get_modpath('survival')..'/functions.lua')
|
||||
dofile(minetest.get_modpath('survival')..'/ores.lua')
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
name = survival
|
||||
description = Adds several survival related items.
|
||||
depends = farming, default, wool, beds, thirsty
|
40
nodes.lua
40
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)
|
||||
|
@ -172,7 +172,7 @@ minetest.register_node('survival:sleeping_bag', {
|
|||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.2, 1.5}, -- Right, Bottom, Back, Left, Top, Front
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.2, 1.5},
|
||||
},
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local n = minetest.get_node_or_nil(pos) --get the location of the placed node
|
||||
|
@ -305,7 +305,6 @@ minetest.register_node('survival:well_bottom', {
|
|||
local n2 = minetest.get_node_or_nil(b2)
|
||||
local n3 = minetest.get_node_or_nil(b3)
|
||||
local def = minetest.registered_items[n2.name] or nil
|
||||
print (n1.name, n2.name)
|
||||
if not n1 and n2 or not def.buildable_to then --not really sure if this is the best code, but it works.
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
|
@ -318,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,
|
||||
})
|
||||
|
||||
|
@ -344,15 +343,13 @@ minetest.register_node('survival:well_top', {
|
|||
local p2 = {x=pos.x, y=pos.y-2, z=pos.z}
|
||||
local n2 = minetest.get_node_or_nil(p)
|
||||
local n3 = minetest.get_node_or_nil(p2)
|
||||
print (n2.name)
|
||||
print (n3.name)
|
||||
if n3.name ~= 'air' or n2.name ~= 'survival:well_bottom' then
|
||||
minetest.remove_node(pos)
|
||||
return true
|
||||
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)
|
||||
|
@ -364,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
|
||||
|
@ -375,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)
|
||||
|
@ -412,9 +415,20 @@ 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
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node('survival:stone_with_salt', {
|
||||
description = 'Salt Ore',
|
||||
tiles = {'default_stone.png^survival_salt_ore.png'},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3},
|
||||
drop = 'survival:salt_lump',
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
minetest.register_ore({
|
||||
ore_type = 'sheet',
|
||||
ore = 'survival:stone_with_salt',
|
||||
wherein = 'default:stone',
|
||||
clust_size = 6,
|
||||
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}
|
||||
})
|
|
@ -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
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 485 B |
Binary file not shown.
After Width: | Height: | Size: 254 B |
Binary file not shown.
After Width: | Height: | Size: 288 B |
|
@ -10,7 +10,7 @@ minetest.register_tool('survival:machete_wood', {
|
|||
choppy = {times = {[2]=3.00, [3]=1.60}, uses=10, maxlevel=1}, --woody
|
||||
snappy = {times = {[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
|
||||
},
|
||||
damage_groups = {fleshy=2}, --damage delt to mobs and other players?
|
||||
damage_groups = {fleshy=2}, --damage dealt to mobs and other players?
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue