clean crafts
This commit is contained in:
parent
ac9c4ae44f
commit
6f9e899ac4
145
crafts.lua
145
crafts.lua
@ -1,19 +1,15 @@
|
||||
local random = water_life.random
|
||||
|
||||
|
||||
|
||||
if not water_life.petz and not water_life.mobsredo then
|
||||
-- lasso
|
||||
|
||||
minetest.register_tool("water_life:lasso", {
|
||||
description = ("Lasso (right-click animal to capture it)"),
|
||||
inventory_image = "water_life_lasso.png",
|
||||
groups = {flammable = 2}
|
||||
})
|
||||
|
||||
if minetest.get_modpath("farming") then
|
||||
minetest.register_craft({
|
||||
output = "water_life:lasso",
|
||||
if minetest.get_modpath("farming") then
|
||||
minetest.register_craft({
|
||||
output = "water_life:lasso",
|
||||
recipe = {
|
||||
{"farming:string", "", "farming:string"},
|
||||
{"", "default:diamond", ""},
|
||||
@ -21,14 +17,10 @@ if not water_life.petz and not water_life.mobsredo then
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- only one kind of meat if mobs_redo is present
|
||||
if not water_life.mobsredo then
|
||||
|
||||
-- raw meat
|
||||
minetest.register_craftitem("water_life:meat_raw", {
|
||||
description = ("Raw Meat"),
|
||||
@ -36,7 +28,6 @@ if not water_life.mobsredo then
|
||||
on_use = minetest.item_eat(3),
|
||||
groups = {food_meat_raw = 1, flammable = 2}
|
||||
})
|
||||
|
||||
-- cooked meat
|
||||
minetest.register_craftitem("water_life:meat", {
|
||||
description = ("Meat"),
|
||||
@ -44,39 +35,37 @@ if not water_life.mobsredo then
|
||||
on_use = minetest.item_eat(8),
|
||||
groups = {food_meat = 1, flammable = 2}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "water_life:meat",
|
||||
recipe = "water_life:meat_raw",
|
||||
cooktime = 5
|
||||
})
|
||||
|
||||
minetest.register_alias("mobs:meat_raw","water_life:meat_raw")
|
||||
minetest.register_alias("mobs:meat","water_life:meat")
|
||||
|
||||
else
|
||||
minetest.register_alias("water_life:meat_raw","mobs:meat_raw")
|
||||
minetest.register_alias("water_life:meat","mobs:meat")
|
||||
|
||||
end
|
||||
|
||||
-- revive corals if a living one is around
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:coral_skeleton","water_life:artificial_skeleton"},
|
||||
neighbors = {"default:water_source"},
|
||||
interval = 30, --30
|
||||
chance = 5, --10
|
||||
interval = 30,
|
||||
chance = 5,
|
||||
catch_up = false,
|
||||
action = function(pos, node)
|
||||
local table = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-2, z=pos.z-2}, {x=pos.x+2, y=pos.y+2, z=pos.z+2}, water_life.urchinspawn)
|
||||
local table = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y-2, z=pos.z-2},
|
||||
{x=pos.x+2, y=pos.y+2, z=pos.z+2}, water_life.urchinspawn)
|
||||
local nname = "default:coral_skeleton"
|
||||
if table and #table > 0 then nname = minetest.get_node(table[water_life.random(#table)]).name end
|
||||
if table and #table > 0 then
|
||||
nname = minetest.get_node(table[water_life.random(#table)]).name
|
||||
end
|
||||
minetest.set_node(pos, {name = nname})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("water_life:artificial_skeleton", {
|
||||
description = "artificial coral skeleton",
|
||||
tiles = {"default_coral_skeleton.png"},
|
||||
@ -85,13 +74,12 @@ minetest.register_node("water_life:artificial_skeleton", {
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
||||
output = "water_life:artificial_skeleton 4",
|
||||
type = "shapeless",
|
||||
recipe = {"default:silver_sandstone","default:silver_sandstone","default:silver_sandstone","default:coral_skeleton"}
|
||||
recipe = {"default:silver_sandstone","default:silver_sandstone",
|
||||
"default:silver_sandstone","default:coral_skeleton"}
|
||||
})
|
||||
|
||||
|
||||
-- moskito repellant
|
||||
if water_life.farming and farming.mod == "redo" then
|
||||
minetest.register_craft({
|
||||
@ -127,14 +115,11 @@ if not water_life.apionly then
|
||||
if placer and not placer:is_player() then return itemstack end
|
||||
if not pointed_thing then return itemstack end
|
||||
if not pointed_thing.type == "node" then return itemstack end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local number = water_life.count_objects(pos)
|
||||
if number.all > water_life.maxmobs or number.fish > 10 then return itemstack end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
if minetest.is_protected(pos,name) then return itemstack end
|
||||
|
||||
local obj = minetest.add_entity(pos, "water_life:fish_tamed")
|
||||
obj = obj:get_luaentity()
|
||||
itemstack:take_item()
|
||||
@ -156,18 +141,14 @@ if not water_life.apionly then
|
||||
if placer and not placer:is_player() then return itemstack end
|
||||
if not pointed_thing then return itemstack end
|
||||
if not pointed_thing.type == "node" then return itemstack end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local number = water_life.count_objects(pos,nil,"water_life:piranha")
|
||||
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
if minetest.is_protected(pos,name) then return itemstack end
|
||||
|
||||
local obj = minetest.add_entity(pos, "water_life:piranha_tamed")
|
||||
obj = obj:get_luaentity()
|
||||
itemstack:take_item()
|
||||
--obj.owner = name
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
@ -185,14 +166,11 @@ if not water_life.apionly then
|
||||
if placer and not placer:is_player() then return itemstack end
|
||||
if not pointed_thing then return itemstack end
|
||||
if not pointed_thing.type == "node" then return itemstack end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local number = water_life.count_objects(pos,nil,"water_life:coralfish_tamed")
|
||||
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
if minetest.is_protected(pos,name) then return itemstack end
|
||||
|
||||
local obj = minetest.add_entity(pos, "water_life:coralfish_tamed")
|
||||
if obj then
|
||||
local entity = obj:get_luaentity()
|
||||
@ -201,7 +179,6 @@ if not water_life.apionly then
|
||||
entity.head = random(65535)
|
||||
end
|
||||
itemstack:take_item()
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
@ -219,22 +196,21 @@ if not water_life.apionly then
|
||||
if placer and not placer:is_player() then return itemstack end
|
||||
if not pointed_thing then return itemstack end
|
||||
if not pointed_thing.type == "node" then return itemstack end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local number = water_life.count_objects(pos,nil,"water_life:clownfish_tamed")
|
||||
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
|
||||
|
||||
if number.all > water_life.maxmobs or number.name > 10 then
|
||||
return itemstack
|
||||
end
|
||||
local name = placer:get_player_name()
|
||||
if minetest.is_protected(pos,name) then return itemstack end
|
||||
|
||||
local obj = minetest.add_entity(pos, "water_life:clownfish_tamed")
|
||||
obj = obj:get_luaentity()
|
||||
itemstack:take_item()
|
||||
obj.owner = name
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("water_life:urchin_item", {
|
||||
description = ("Sea urchin"),
|
||||
inventory_image = "water_life_urchin_item.png",
|
||||
@ -248,25 +224,18 @@ if not water_life.apionly then
|
||||
if placer and not placer:is_player() then return itemstack end
|
||||
if not pointed_thing then return itemstack end
|
||||
if not pointed_thing.type == "node" then return itemstack end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local number = water_life.count_objects(pos,10,"water_life:urchin")
|
||||
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
if minetest.is_protected(pos,name) then return itemstack end
|
||||
|
||||
local obj = water_life.set_urchin(pos)
|
||||
obj = obj:get_luaentity()
|
||||
itemstack:take_item()
|
||||
--obj.owner = name
|
||||
return itemstack
|
||||
end,
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_craftitem("water_life:jellyfish_item", {
|
||||
description = ("Jellyfish"),
|
||||
inventory_image = "water_life_jellyfish_item.png",
|
||||
@ -280,50 +249,37 @@ if not water_life.apionly then
|
||||
if placer and not placer:is_player() then return itemstack end
|
||||
if not pointed_thing then return itemstack end
|
||||
if not pointed_thing.type == "node" then return itemstack end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local number = water_life.count_objects(pos,10,"water_life:jellyfish")
|
||||
if number.all > water_life.maxmobs or number.name > 10 then return itemstack end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
if minetest.is_protected(pos,name) then return itemstack end
|
||||
|
||||
local obj = minetest.add_entity(pos, "water_life:jellyfish")
|
||||
|
||||
if obj then itemstack:take_item() end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_craftitem("water_life:snake_item", {
|
||||
description = ("Rattlesnake"),
|
||||
inventory_image = "water_life_snake_item.png",
|
||||
wield_scale = {x = 0.4, y = 0.4, z = 0.4},
|
||||
stack_max = 10,
|
||||
liquids_pointable = false,
|
||||
range = 10,
|
||||
on_use = minetest.item_eat(5),
|
||||
groups = {food_meat = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
minetest.register_craftitem("water_life:snake_item", {
|
||||
description = ("Rattlesnake"),
|
||||
inventory_image = "water_life_snake_item.png",
|
||||
wield_scale = {x = 0.4, y = 0.4, z = 0.4},
|
||||
stack_max = 10,
|
||||
liquids_pointable = false,
|
||||
range = 10,
|
||||
on_use = minetest.item_eat(5),
|
||||
groups = {food_meat = 1, flammable = 2},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if placer and not placer:is_player() then return itemstack end
|
||||
if not pointed_thing then return itemstack end
|
||||
if not pointed_thing.type == "node" then return itemstack end
|
||||
|
||||
local pos = pointed_thing.above
|
||||
local number = water_life.count_objects(pos,water_life.abr * 16,"water_life:snake")
|
||||
if number.all > water_life.maxmobs or number.name > 5 then return itemstack end
|
||||
|
||||
local name = placer:get_player_name()
|
||||
if minetest.is_protected(pos,name) then return itemstack end
|
||||
|
||||
local obj = minetest.add_entity(pos, "water_life:snake")
|
||||
|
||||
if obj then itemstack:take_item() end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
@ -334,39 +290,32 @@ if not water_life.apionly then
|
||||
wield_scale = {x = 0.4, y = 0.4, z = 0.4},
|
||||
liquids_pointable = false,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if not user or not user:is_player() then return itemstack end
|
||||
|
||||
local name = user:get_player_name()
|
||||
local meta = user:get_meta()
|
||||
local score = user:get_hp()
|
||||
|
||||
if meta:get_int("snakepoison") > 0 then meta:set_int("snakepoison",0) end
|
||||
user:set_hp(score+10)
|
||||
itemstack:take_item()
|
||||
water_life.change_hud(user,"poison",0)
|
||||
return itemstack
|
||||
if not user or not user:is_player() then return itemstack end
|
||||
local name = user:get_player_name()
|
||||
local meta = user:get_meta()
|
||||
local score = user:get_hp()
|
||||
if meta:get_int("snakepoison") > 0 then meta:set_int("snakepoison",0) end
|
||||
user:set_hp(score+10)
|
||||
itemstack:take_item()
|
||||
water_life.change_hud(user,"poison",0)
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
groups = {vessel = 1},
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_craftitem("water_life:repellant", {
|
||||
description = ("No moskitos for half a day"),
|
||||
inventory_image = "water_life_repell.png",
|
||||
wield_scale = {x = 0.4, y = 0.4, z = 0.4},
|
||||
liquids_pointable = false,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if not user or not user:is_player() then return itemstack end
|
||||
|
||||
local name = user:get_player_name()
|
||||
local meta = user:get_meta()
|
||||
|
||||
meta:set_int("repellant",math.floor(os.time()))
|
||||
itemstack:take_item()
|
||||
|
||||
water_life.change_hud(user,"repellant")
|
||||
return itemstack
|
||||
if not user or not user:is_player() then return itemstack end
|
||||
local name = user:get_player_name()
|
||||
local meta = user:get_meta()
|
||||
meta:set_int("repellant",math.floor(os.time()))
|
||||
itemstack:take_item()
|
||||
water_life.change_hud(user,"repellant")
|
||||
return itemstack
|
||||
end,
|
||||
|
||||
groups = {vessel = 1},
|
||||
@ -385,11 +334,9 @@ if not water_life.apionly then
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
--muddy water
|
||||
|
||||
if water_life.muddy_water then
|
||||
|
||||
minetest.register_node("water_life:muddy_river_water_source", {
|
||||
description = "Muddy river water source",
|
||||
drawtype = "liquid",
|
||||
@ -555,4 +502,4 @@ minetest.register_craftitem("water_life:crocleather", {
|
||||
wield_scale = {x = 0.5, y = 0.5, z = 0.5},
|
||||
liquids_pointable = false,
|
||||
groups = {leather = 1, flammable = 2},
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user