Foods increase thirst, thirsty added as required mod.
This commit is contained in:
parent
add18abe65
commit
be7c8cb16b
@ -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'
|
||||
})
|
||||
|
@ -2,4 +2,4 @@ farming
|
||||
default
|
||||
wool
|
||||
beds
|
||||
thirsty?
|
||||
thirsty
|
||||
|
51
foods.lua
51
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(player)
|
||||
local hp_gain = math.random(-4,1)
|
||||
local hp = player:get_hp()
|
||||
player:set_hp(hp + hp_gain)
|
||||
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')
|
||||
|
14
nodes.lua
14
nodes.lua
@ -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
|
||||
@ -344,8 +343,6 @@ 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
|
||||
@ -418,3 +415,12 @@ minetest.register_node('survival:well_top', {
|
||||
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(),
|
||||
})
|
||||
|
9
ores.lua
Normal file
9
ores.lua
Normal file
@ -0,0 +1,9 @@
|
||||
minetest.register_ore({
|
||||
ore_type = 'sheet',
|
||||
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}
|
||||
})
|
BIN
textures/survival_salt.png
Normal file
BIN
textures/survival_salt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 485 B |
BIN
textures/survival_salt_lump.png
Normal file
BIN
textures/survival_salt_lump.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 254 B |
BIN
textures/survival_salt_ore.png
Normal file
BIN
textures/survival_salt_ore.png
Normal file
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…
x
Reference in New Issue
Block a user