mirror of
https://codeberg.org/tenplus1/mobs_animal.git
synced 2025-05-05 10:50:21 +02:00
change minetest. to core.
This commit is contained in:
parent
8480571665
commit
2d9f94f5c7
34
bee.lua
34
bee.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- Bee by KrupnoPavel (.b3d model by sirrobzeroone)
|
-- Bee by KrupnoPavel (.b3d model by sirrobzeroone)
|
||||||
|
|
||||||
@ -68,10 +68,10 @@ mobs:alias_mob("mobs:bee", "mobs_animal:bee")
|
|||||||
|
|
||||||
-- honey
|
-- honey
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:honey", {
|
core.register_craftitem(":mobs:honey", {
|
||||||
description = S("Honey"),
|
description = S("Honey"),
|
||||||
inventory_image = "mobs_honey_inv.png",
|
inventory_image = "mobs_honey_inv.png",
|
||||||
on_use = minetest.item_eat(4),
|
on_use = core.item_eat(4),
|
||||||
groups = {food_honey = 1, food_sugar = 1}
|
groups = {food_honey = 1, food_sugar = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ mobs.add_eatable("mobs:honey", 4)
|
|||||||
|
|
||||||
-- beehive (1 in 4 chance of spawning bee when placed)
|
-- beehive (1 in 4 chance of spawning bee when placed)
|
||||||
|
|
||||||
minetest.register_node(":mobs:beehive", {
|
core.register_node(":mobs:beehive", {
|
||||||
description = S("Beehive"),
|
description = S("Beehive"),
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {"mobs_beehive.png"},
|
tiles = {"mobs_beehive.png"},
|
||||||
@ -93,7 +93,7 @@ minetest.register_node(":mobs:beehive", {
|
|||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local gui_bg = default and default.gui_bg .. default.gui_bg_img .. default.gui_slots or ""
|
local gui_bg = default and default.gui_bg .. default.gui_bg_img .. default.gui_slots or ""
|
||||||
|
|
||||||
meta:set_string("formspec", "size[8,6]"
|
meta:set_string("formspec", "size[8,6]"
|
||||||
@ -110,10 +110,10 @@ minetest.register_node(":mobs:beehive", {
|
|||||||
|
|
||||||
if placer and placer:is_player() then
|
if placer and placer:is_player() then
|
||||||
|
|
||||||
minetest.set_node(pos, {name = "mobs:beehive", param2 = 1})
|
core.set_node(pos, {name = "mobs:beehive", param2 = 1})
|
||||||
|
|
||||||
if math.random(4) == 1 then
|
if math.random(4) == 1 then
|
||||||
minetest.add_entity(pos, "mobs_animal:bee")
|
core.add_entity(pos, "mobs_animal:bee")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -121,7 +121,7 @@ minetest.register_node(":mobs:beehive", {
|
|||||||
on_punch = function(pos, node, puncher)
|
on_punch = function(pos, node, puncher)
|
||||||
|
|
||||||
-- yep, bee's don't like having their home punched by players
|
-- yep, bee's don't like having their home punched by players
|
||||||
minetest.after(0.2, function()
|
core.after(0.2, function()
|
||||||
|
|
||||||
local hp = puncher and puncher:get_hp()
|
local hp = puncher and puncher:get_hp()
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ minetest.register_node(":mobs:beehive", {
|
|||||||
|
|
||||||
can_dig = function(pos,player) -- can only dig when no honey inside
|
can_dig = function(pos,player) -- can only dig when no honey inside
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
|
|
||||||
return meta:get_inventory():is_empty("beehive")
|
return meta:get_inventory():is_empty("beehive")
|
||||||
end
|
end
|
||||||
@ -146,14 +146,14 @@ minetest.register_node(":mobs:beehive", {
|
|||||||
|
|
||||||
-- beehive recipe
|
-- beehive recipe
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:beehive",
|
output = "mobs:beehive",
|
||||||
recipe = {{"mobs:bee","mobs:bee","mobs:bee"}}
|
recipe = {{"mobs:bee","mobs:bee","mobs:bee"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- honey block and craft recipes
|
-- honey block and craft recipes
|
||||||
|
|
||||||
minetest.register_node(":mobs:honey_block", {
|
core.register_node(":mobs:honey_block", {
|
||||||
description = S("Honey Block"),
|
description = S("Honey Block"),
|
||||||
tiles = {"mobs_honey_block.png"},
|
tiles = {"mobs_honey_block.png"},
|
||||||
groups = {snappy = 3, flammable = 2},
|
groups = {snappy = 3, flammable = 2},
|
||||||
@ -161,7 +161,7 @@ minetest.register_node(":mobs:honey_block", {
|
|||||||
sounds = mobs.node_sound_dirt_defaults()
|
sounds = mobs.node_sound_dirt_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:honey_block",
|
output = "mobs:honey_block",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mobs:honey", "mobs:honey", "mobs:honey"},
|
{"mobs:honey", "mobs:honey", "mobs:honey"},
|
||||||
@ -170,7 +170,7 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:honey 9",
|
output = "mobs:honey 9",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mobs:honey_block"}
|
{"mobs:honey_block"}
|
||||||
@ -179,7 +179,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- beehive workings
|
-- beehive workings
|
||||||
|
|
||||||
minetest.register_abm({
|
core.register_abm({
|
||||||
nodenames = {"mobs:beehive"},
|
nodenames = {"mobs:beehive"},
|
||||||
interval = 12,
|
interval = 12,
|
||||||
chance = 6,
|
chance = 6,
|
||||||
@ -188,18 +188,18 @@ minetest.register_abm({
|
|||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
|
|
||||||
-- bee's only make honey during the day
|
-- bee's only make honey during the day
|
||||||
local tod = (minetest.get_timeofday() or 0) * 24000
|
local tod = (core.get_timeofday() or 0) * 24000
|
||||||
|
|
||||||
if tod < 5500 or tod > 18500 then return end
|
if tod < 5500 or tod > 18500 then return end
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos) ; if not meta then return end
|
local meta = core.get_meta(pos) ; if not meta then return end
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local honey = inv:get_stack("beehive", 1):get_count()
|
local honey = inv:get_stack("beehive", 1):get_count()
|
||||||
|
|
||||||
if honey > 11 then return end -- return if hive full
|
if honey > 11 then return end -- return if hive full
|
||||||
|
|
||||||
-- no flowers no honey, nuff said!
|
-- no flowers no honey, nuff said!
|
||||||
if #minetest.find_nodes_in_area_under_air(
|
if #core.find_nodes_in_area_under_air(
|
||||||
{x = pos.x - 4, y = pos.y - 3, z = pos.z - 4},
|
{x = pos.x - 4, y = pos.y - 3, z = pos.z - 4},
|
||||||
{x = pos.x + 4, y = pos.y + 3, z = pos.z + 4}, "group:flower") > 3 then
|
{x = pos.x + 4, y = pos.y + 3, z = pos.z + 4}, "group:flower") > 3 then
|
||||||
|
|
||||||
|
30
bunny.lua
30
bunny.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- Bunny by ExeterDad
|
-- Bunny by ExeterDad
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ mobs:register_mob("mobs_animal:bunny", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- set special bunny attributes
|
-- set special bunny attributes
|
||||||
local staticdata = minetest.serialize({
|
local staticdata = core.serialize({
|
||||||
type = "monster",
|
type = "monster",
|
||||||
attack_type = "dogfight",
|
attack_type = "dogfight",
|
||||||
health = 20,
|
health = 20,
|
||||||
@ -84,7 +84,7 @@ mobs:register_mob("mobs_animal:bunny", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
-- add evil bunny
|
-- add evil bunny
|
||||||
local obj = minetest.add_entity(
|
local obj = core.add_entity(
|
||||||
self.object:get_pos(), "mobs_animal:bunny", staticdata)
|
self.object:get_pos(), "mobs_animal:bunny", staticdata)
|
||||||
|
|
||||||
obj:set_properties({textures = {"mobs_bunny_evil.png"}, hp_max = 20})
|
obj:set_properties({textures = {"mobs_bunny_evil.png"}, hp_max = 20})
|
||||||
@ -99,19 +99,19 @@ mobs:register_mob("mobs_animal:bunny", {
|
|||||||
local pos = self.object:get_pos() ; pos.y = pos.y - 1
|
local pos = self.object:get_pos() ; pos.y = pos.y - 1
|
||||||
|
|
||||||
-- white snowy bunny
|
-- white snowy bunny
|
||||||
if minetest.find_node_near(pos, 1,
|
if core.find_node_near(pos, 1,
|
||||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||||
self.base_texture = {"mobs_bunny_white.png"}
|
self.base_texture = {"mobs_bunny_white.png"}
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
|
|
||||||
-- brown desert bunny
|
-- brown desert bunny
|
||||||
elseif minetest.find_node_near(pos, 1,
|
elseif core.find_node_near(pos, 1,
|
||||||
{"default:desert_sand", "default:desert_stone"}) then
|
{"default:desert_sand", "default:desert_stone"}) then
|
||||||
self.base_texture = {"mobs_bunny_brown.png"}
|
self.base_texture = {"mobs_bunny_brown.png"}
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
|
|
||||||
-- grey stone bunny
|
-- grey stone bunny
|
||||||
elseif minetest.find_node_near(pos, 1,
|
elseif core.find_node_near(pos, 1,
|
||||||
{"default:stone", "default:gravel"}) then
|
{"default:stone", "default:gravel"}) then
|
||||||
self.base_texture = {"mobs_bunny_grey.png"}
|
self.base_texture = {"mobs_bunny_grey.png"}
|
||||||
self.object:set_properties({textures = self.base_texture})
|
self.object:set_properties({textures = self.base_texture})
|
||||||
@ -127,7 +127,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
|
|
||||||
local spawn_on = "default:dirt_with_grass"
|
local spawn_on = "default:dirt_with_grass"
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") then
|
if core.get_modpath("ethereal") then
|
||||||
spawn_on = "ethereal:prairie_dirt"
|
spawn_on = "ethereal:prairie_dirt"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -154,10 +154,10 @@ mobs:alias_mob("mobs:bunny", "mobs_animal:bunny")
|
|||||||
|
|
||||||
-- raw rabbit
|
-- raw rabbit
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:rabbit_raw", {
|
core.register_craftitem(":mobs:rabbit_raw", {
|
||||||
description = S("Raw Rabbit"),
|
description = S("Raw Rabbit"),
|
||||||
inventory_image = "mobs_rabbit_raw.png",
|
inventory_image = "mobs_rabbit_raw.png",
|
||||||
on_use = minetest.item_eat(3),
|
on_use = core.item_eat(3),
|
||||||
groups = {food_meat_raw = 1, food_rabbit_raw = 1}
|
groups = {food_meat_raw = 1, food_rabbit_raw = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -165,16 +165,16 @@ mobs.add_eatable("mobs:rabbit_raw", 3)
|
|||||||
|
|
||||||
-- cooked rabbit
|
-- cooked rabbit
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:rabbit_cooked", {
|
core.register_craftitem(":mobs:rabbit_cooked", {
|
||||||
description = S("Cooked Rabbit"),
|
description = S("Cooked Rabbit"),
|
||||||
inventory_image = "mobs_rabbit_cooked.png",
|
inventory_image = "mobs_rabbit_cooked.png",
|
||||||
on_use = minetest.item_eat(5),
|
on_use = core.item_eat(5),
|
||||||
groups = {food_meat = 1, food_rabbit = 1}
|
groups = {food_meat = 1, food_rabbit = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:rabbit_cooked", 5)
|
mobs.add_eatable("mobs:rabbit_cooked", 5)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mobs:rabbit_cooked",
|
output = "mobs:rabbit_cooked",
|
||||||
recipe = "mobs:rabbit_raw",
|
recipe = "mobs:rabbit_raw",
|
||||||
@ -183,15 +183,15 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- rabbit hide and recipes
|
-- rabbit hide and recipes
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:rabbit_hide", {
|
core.register_craftitem(":mobs:rabbit_hide", {
|
||||||
description = S("Rabbit Hide"),
|
description = S("Rabbit Hide"),
|
||||||
inventory_image = "mobs_rabbit_hide.png",
|
inventory_image = "mobs_rabbit_hide.png",
|
||||||
groups = {flammable = 2, pelt = 1}
|
groups = {flammable = 2, pelt = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({type = "fuel", recipe = "mobs:rabbit_hide", burntime = 2})
|
core.register_craft({type = "fuel", recipe = "mobs:rabbit_hide", burntime = 2})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:leather",
|
output = "mobs:leather",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mobs:rabbit_hide", "mobs:rabbit_hide"},
|
{"mobs:rabbit_hide", "mobs:rabbit_hide"},
|
||||||
|
46
chicken.lua
46
chicken.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- Chicken by JK Murray and Sirrobzeroone
|
-- Chicken by JK Murray and Sirrobzeroone
|
||||||
|
|
||||||
@ -84,13 +84,13 @@ mobs:register_mob("mobs_animal:chicken", {
|
|||||||
|
|
||||||
if math.random(100) == 1 then
|
if math.random(100) == 1 then
|
||||||
|
|
||||||
minetest.add_item(pos, "mobs:egg")
|
core.add_item(pos, "mobs:egg")
|
||||||
|
|
||||||
minetest.sound_play("default_place_node_hard",
|
core.sound_play("default_place_node_hard",
|
||||||
{pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
{pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
|
|
||||||
elseif math.random(100) < 3 then
|
elseif math.random(100) < 3 then
|
||||||
minetest.add_item(pos, "mobs:chicken_feather")
|
core.add_item(pos, "mobs:chicken_feather")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -101,7 +101,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
|
|
||||||
local spawn_on = {"default:dirt_with_grass"}
|
local spawn_on = {"default:dirt_with_grass"}
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") then
|
if core.get_modpath("ethereal") then
|
||||||
spawn_on = {"ethereal:bamboo_dirt", "ethereal:prairie_dirt"}
|
spawn_on = {"ethereal:bamboo_dirt", "ethereal:prairie_dirt"}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ mobs:register_arrow("mobs_animal:egg_entity", {
|
|||||||
|
|
||||||
hit_player = function(self, player)
|
hit_player = function(self, player)
|
||||||
|
|
||||||
player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, {
|
player:punch(core.get_player_by_name(self.playername) or self.object, 1.0, {
|
||||||
full_punch_interval = 1.0,
|
full_punch_interval = 1.0,
|
||||||
damage_groups = {fleshy = 1}
|
damage_groups = {fleshy = 1}
|
||||||
}, nil)
|
}, nil)
|
||||||
@ -156,10 +156,10 @@ mobs:register_arrow("mobs_animal:egg_entity", {
|
|||||||
|
|
||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
local nod = minetest.get_node_or_nil(pos)
|
local nod = core.get_node_or_nil(pos)
|
||||||
|
|
||||||
if not nod or not minetest.registered_nodes[nod.name]
|
if not nod or not core.registered_nodes[nod.name]
|
||||||
or minetest.registered_nodes[nod.name].walkable == true then
|
or core.registered_nodes[nod.name].walkable == true then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -182,10 +182,10 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
|
|||||||
|
|
||||||
local playerpos = player:get_pos()
|
local playerpos = player:get_pos()
|
||||||
|
|
||||||
minetest.sound_play("default_place_node_hard",
|
core.sound_play("default_place_node_hard",
|
||||||
{pos = playerpos, gain = 1.0, max_hear_distance = 5}, true)
|
{pos = playerpos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
|
|
||||||
local obj = minetest.add_entity({
|
local obj = core.add_entity({
|
||||||
x = playerpos.x,
|
x = playerpos.x,
|
||||||
y = playerpos.y +1.5,
|
y = playerpos.y +1.5,
|
||||||
z = playerpos.z
|
z = playerpos.z
|
||||||
@ -216,7 +216,7 @@ end
|
|||||||
|
|
||||||
-- egg
|
-- egg
|
||||||
|
|
||||||
minetest.register_node(":mobs:egg", {
|
core.register_node(":mobs:egg", {
|
||||||
description = S("Chicken Egg"),
|
description = S("Chicken Egg"),
|
||||||
tiles = {"mobs_chicken_egg.png"},
|
tiles = {"mobs_chicken_egg.png"},
|
||||||
inventory_image = "mobs_chicken_egg.png",
|
inventory_image = "mobs_chicken_egg.png",
|
||||||
@ -235,7 +235,7 @@ minetest.register_node(":mobs:egg", {
|
|||||||
sounds = mobs.node_sound_defaults(),
|
sounds = mobs.node_sound_defaults(),
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack)
|
after_place_node = function(pos, placer, itemstack)
|
||||||
minetest.set_node(pos, {name = "mobs:egg", param2 = 1})
|
core.set_node(pos, {name = "mobs:egg", param2 = 1})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_use = mobs_shoot_egg
|
on_use = mobs_shoot_egg
|
||||||
@ -243,16 +243,16 @@ minetest.register_node(":mobs:egg", {
|
|||||||
|
|
||||||
-- fried egg and recipe
|
-- fried egg and recipe
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:chicken_egg_fried", {
|
core.register_craftitem(":mobs:chicken_egg_fried", {
|
||||||
description = S("Fried Egg"),
|
description = S("Fried Egg"),
|
||||||
inventory_image = "mobs_chicken_egg_fried.png",
|
inventory_image = "mobs_chicken_egg_fried.png",
|
||||||
on_use = minetest.item_eat(2),
|
on_use = core.item_eat(2),
|
||||||
groups = {food_egg_fried = 1}
|
groups = {food_egg_fried = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:chicken_egg_fried", 2)
|
mobs.add_eatable("mobs:chicken_egg_fried", 2)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
recipe = "mobs:egg",
|
recipe = "mobs:egg",
|
||||||
output = "mobs:chicken_egg_fried"
|
output = "mobs:chicken_egg_fried"
|
||||||
@ -260,10 +260,10 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- raw chicken
|
-- raw chicken
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:chicken_raw", {
|
core.register_craftitem(":mobs:chicken_raw", {
|
||||||
description = S("Raw Chicken"),
|
description = S("Raw Chicken"),
|
||||||
inventory_image = "mobs_chicken_raw.png",
|
inventory_image = "mobs_chicken_raw.png",
|
||||||
on_use = minetest.item_eat(2),
|
on_use = core.item_eat(2),
|
||||||
groups = {food_meat_raw = 1, food_chicken_raw = 1}
|
groups = {food_meat_raw = 1, food_chicken_raw = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -271,16 +271,16 @@ mobs.add_eatable("mobs:chicken_raw", 2)
|
|||||||
|
|
||||||
-- cooked chicken and recipe
|
-- cooked chicken and recipe
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:chicken_cooked", {
|
core.register_craftitem(":mobs:chicken_cooked", {
|
||||||
description = S("Cooked Chicken"),
|
description = S("Cooked Chicken"),
|
||||||
inventory_image = "mobs_chicken_cooked.png",
|
inventory_image = "mobs_chicken_cooked.png",
|
||||||
on_use = minetest.item_eat(6),
|
on_use = core.item_eat(6),
|
||||||
groups = {food_meat = 1, food_chicken = 1}
|
groups = {food_meat = 1, food_chicken = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:chicken_cooked", 6)
|
mobs.add_eatable("mobs:chicken_cooked", 6)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
recipe = "mobs:chicken_raw",
|
recipe = "mobs:chicken_raw",
|
||||||
output = "mobs:chicken_cooked"
|
output = "mobs:chicken_cooked"
|
||||||
@ -288,10 +288,10 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- feather and fuel
|
-- feather and fuel
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:chicken_feather", {
|
core.register_craftitem(":mobs:chicken_feather", {
|
||||||
description = S("Feather"),
|
description = S("Feather"),
|
||||||
inventory_image = "mobs_chicken_feather.png",
|
inventory_image = "mobs_chicken_feather.png",
|
||||||
groups = {flammable = 2, feather = 1}
|
groups = {flammable = 2, feather = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({type = "fuel", recipe = "mobs:chicken_feather", burntime = 1})
|
core.register_craft({type = "fuel", recipe = "mobs:chicken_feather", burntime = 1})
|
||||||
|
54
cow.lua
54
cow.lua
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- should cows eat grass blocks and mess up the environment?
|
-- should cows eat grass blocks and mess up the environment?
|
||||||
|
|
||||||
local eat_gb = minetest.settings:get_bool("mobs_animal.eat_grass_block")
|
local eat_gb = core.settings:get_bool("mobs_animal.eat_grass_block")
|
||||||
local replace_what = { {"group:grass", "air", 0} }
|
local replace_what = { {"group:grass", "air", 0} }
|
||||||
|
|
||||||
if eat_gb then
|
if eat_gb then
|
||||||
@ -104,7 +104,7 @@ mobs:register_mob("mobs_animal:cow", {
|
|||||||
|
|
||||||
if self.gotten == true then
|
if self.gotten == true then
|
||||||
|
|
||||||
minetest.chat_send_player(name, S("Cow already milked!"))
|
core.chat_send_player(name, S("Cow already milked!"))
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -129,7 +129,7 @@ mobs:register_mob("mobs_animal:cow", {
|
|||||||
|
|
||||||
pos.y = pos.y + 0.5
|
pos.y = pos.y + 0.5
|
||||||
|
|
||||||
minetest.add_item(pos, {name = ret_item})
|
core.add_item(pos, {name = ret_item})
|
||||||
end
|
end
|
||||||
|
|
||||||
self.gotten = true -- milked
|
self.gotten = true -- milked
|
||||||
@ -176,27 +176,27 @@ mobs:alias_mob("mobs:cow", "mobs_animal:cow")
|
|||||||
|
|
||||||
-- bucket of milk
|
-- bucket of milk
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:bucket_milk", {
|
core.register_craftitem(":mobs:bucket_milk", {
|
||||||
description = S("Bucket of Milk"),
|
description = S("Bucket of Milk"),
|
||||||
inventory_image = "mobs_bucket_milk.png",
|
inventory_image = "mobs_bucket_milk.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = minetest.item_eat(8, "bucket:bucket_empty"),
|
on_use = core.item_eat(8, "bucket:bucket_empty"),
|
||||||
groups = {food_milk = 1, drink = 1}
|
groups = {food_milk = 1, drink = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:bucket_milk", 8)
|
mobs.add_eatable("mobs:bucket_milk", 8)
|
||||||
|
|
||||||
-- glass of milk and recipes
|
-- glass of milk and recipes
|
||||||
minetest.register_craftitem(":mobs:glass_milk", {
|
core.register_craftitem(":mobs:glass_milk", {
|
||||||
description = S("Glass of Milk"),
|
description = S("Glass of Milk"),
|
||||||
inventory_image = "mobs_glass_milk.png",
|
inventory_image = "mobs_glass_milk.png",
|
||||||
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
|
on_use = core.item_eat(2, "vessels:drinking_glass"),
|
||||||
groups = {food_milk_glass = 1, vessel = 1, drink = 1}
|
groups = {food_milk_glass = 1, vessel = 1, drink = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:glass_milk", 2)
|
mobs.add_eatable("mobs:glass_milk", 2)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:glass_milk 4",
|
output = "mobs:glass_milk 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"vessels:drinking_glass", "vessels:drinking_glass"},
|
{"vessels:drinking_glass", "vessels:drinking_glass"},
|
||||||
@ -206,7 +206,7 @@ minetest.register_craft({
|
|||||||
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:bucket_milk",
|
output = "mobs:bucket_milk",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:food_milk_glass", "group:food_milk_glass"},
|
{"group:food_milk_glass", "group:food_milk_glass"},
|
||||||
@ -220,10 +220,10 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- butter and recipe
|
-- butter and recipe
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:butter", {
|
core.register_craftitem(":mobs:butter", {
|
||||||
description = S("Butter"),
|
description = S("Butter"),
|
||||||
inventory_image = "mobs_butter.png",
|
inventory_image = "mobs_butter.png",
|
||||||
on_use = minetest.item_eat(1),
|
on_use = core.item_eat(1),
|
||||||
groups = {food_butter = 1}
|
groups = {food_butter = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -231,11 +231,11 @@ mobs.add_eatable("mobs:butter", 1)
|
|||||||
|
|
||||||
local salt_item = "default:sapling" -- some saplings are high in sodium
|
local salt_item = "default:sapling" -- some saplings are high in sodium
|
||||||
|
|
||||||
if minetest.get_modpath("farming") and farming and farming.mod then
|
if core.get_modpath("farming") and farming and farming.mod then
|
||||||
salt_item = "farming:salt"
|
salt_item = "farming:salt"
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:butter",
|
output = "mobs:butter",
|
||||||
recipe = {{"mobs:bucket_milk", salt_item}},
|
recipe = {{"mobs:bucket_milk", salt_item}},
|
||||||
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
|
||||||
@ -243,16 +243,16 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- cheese wedge and recipe
|
-- cheese wedge and recipe
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:cheese", {
|
core.register_craftitem(":mobs:cheese", {
|
||||||
description = S("Cheese"),
|
description = S("Cheese"),
|
||||||
inventory_image = "mobs_cheese.png",
|
inventory_image = "mobs_cheese.png",
|
||||||
on_use = minetest.item_eat(4),
|
on_use = core.item_eat(4),
|
||||||
groups = {food_cheese = 1}
|
groups = {food_cheese = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:cheese", 4)
|
mobs.add_eatable("mobs:cheese", 4)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mobs:cheese",
|
output = "mobs:cheese",
|
||||||
recipe = "mobs:bucket_milk",
|
recipe = "mobs:bucket_milk",
|
||||||
@ -262,7 +262,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
-- cheese block and recipe
|
-- cheese block and recipe
|
||||||
|
|
||||||
minetest.register_node(":mobs:cheeseblock", {
|
core.register_node(":mobs:cheeseblock", {
|
||||||
description = S("Cheese Block"),
|
description = S("Cheese Block"),
|
||||||
tiles = {"mobs_cheeseblock.png"},
|
tiles = {"mobs_cheeseblock.png"},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
@ -270,7 +270,7 @@ minetest.register_node(":mobs:cheeseblock", {
|
|||||||
sounds = mobs.node_sound_dirt_defaults()
|
sounds = mobs.node_sound_dirt_defaults()
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:cheeseblock",
|
output = "mobs:cheeseblock",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:food_cheese", "group:food_cheese", "group:food_cheese"},
|
{"group:food_cheese", "group:food_cheese", "group:food_cheese"},
|
||||||
@ -279,30 +279,30 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:cheese 9",
|
output = "mobs:cheese 9",
|
||||||
recipe = {{"mobs:cheeseblock"}}
|
recipe = {{"mobs:cheeseblock"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- check for either of the wood bucket mods and add compatibility
|
-- check for either of the wood bucket mods and add compatibility
|
||||||
|
|
||||||
local wb = minetest.get_modpath("wooden_bucket")
|
local wb = core.get_modpath("wooden_bucket")
|
||||||
local bw = minetest.get_modpath("bucket_wooden")
|
local bw = core.get_modpath("bucket_wooden")
|
||||||
|
|
||||||
if wb or bw then
|
if wb or bw then
|
||||||
|
|
||||||
local return_item = wb and "wooden_bucket:bucket_wood_empty"
|
local return_item = wb and "wooden_bucket:bucket_wood_empty"
|
||||||
or "bucket_wooden:bucket_empty"
|
or "bucket_wooden:bucket_empty"
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:wooden_bucket_milk", {
|
core.register_craftitem(":mobs:wooden_bucket_milk", {
|
||||||
description = S("Wooden Bucket of Milk"),
|
description = S("Wooden Bucket of Milk"),
|
||||||
inventory_image = "mobs_wooden_bucket_milk.png",
|
inventory_image = "mobs_wooden_bucket_milk.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = minetest.item_eat(8, return_item),
|
on_use = core.item_eat(8, return_item),
|
||||||
groups = {food_milk = 1, flammable = 3, drink = 1}
|
groups = {food_milk = 1, flammable = 3, drink = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:glass_milk 4",
|
output = "mobs:glass_milk 4",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"vessels:drinking_glass", "vessels:drinking_glass"},
|
{"vessels:drinking_glass", "vessels:drinking_glass"},
|
||||||
@ -312,7 +312,7 @@ if wb or bw then
|
|||||||
replacements = {{"mobs:wooden_bucket_milk", return_item}}
|
replacements = {{"mobs:wooden_bucket_milk", return_item}}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:wooden_bucket_milk",
|
output = "mobs:wooden_bucket_milk",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:food_milk_glass", "group:food_milk_glass"},
|
{"group:food_milk_glass", "group:food_milk_glass"},
|
||||||
@ -324,7 +324,7 @@ if wb or bw then
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = "mobs:butter",
|
output = "mobs:butter",
|
||||||
recipe = {{"mobs:wooden_bucket_milk", salt_item}},
|
recipe = {{"mobs:wooden_bucket_milk", salt_item}},
|
||||||
replacements = {{"mobs:wooden_bucket_milk", return_item}}
|
replacements = {{"mobs:wooden_bucket_milk", return_item}}
|
||||||
|
8
init.lua
8
init.lua
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
-- translation and mod path
|
-- translation and mod path
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
local path = minetest.get_modpath(minetest.get_current_modname()) .. "/"
|
local path = core.get_modpath(core.get_current_modname()) .. "/"
|
||||||
|
|
||||||
-- Check for custom mob spawn file
|
-- Check for custom mob spawn file
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ end
|
|||||||
|
|
||||||
local function ddoo(mob)
|
local function ddoo(mob)
|
||||||
|
|
||||||
if minetest.settings:get_bool("mobs_animal." .. mob) == false then
|
if core.settings:get_bool("mobs_animal." .. mob) == false then
|
||||||
print("[Mobs_Animal] " .. mob .. " disabled!")
|
print("[Mobs_Animal] " .. mob .. " disabled!")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -47,7 +47,7 @@ end
|
|||||||
|
|
||||||
-- Lucky Blocks
|
-- Lucky Blocks
|
||||||
|
|
||||||
if minetest.get_modpath("lucky_block") then
|
if core.get_modpath("lucky_block") then
|
||||||
dofile(path .. "lucky_block.lua")
|
dofile(path .. "lucky_block.lua")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
20
kitten.lua
20
kitten.lua
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
-- translation and hairball setting
|
-- translation and hairball setting
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
local hairball = minetest.settings:get_bool("mobs_animal.hairball") ~= false
|
local hairball = core.settings:get_bool("mobs_animal.hairball") ~= false
|
||||||
|
|
||||||
-- custom kitty types
|
-- custom kitty types
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ mobs:register_mob("mobs_animal:kitten", {
|
|||||||
|
|
||||||
tmp = kitten_types[n]
|
tmp = kitten_types[n]
|
||||||
|
|
||||||
if minetest.find_node_near(pos, 1, tmp.nodes) then
|
if core.find_node_near(pos, 1, tmp.nodes) then
|
||||||
|
|
||||||
self.base_texture = tmp.skins
|
self.base_texture = tmp.skins
|
||||||
self.object:set_properties({textures = tmp.skins})
|
self.object:set_properties({textures = tmp.skins})
|
||||||
@ -119,9 +119,9 @@ mobs:register_mob("mobs_animal:kitten", {
|
|||||||
|
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
minetest.add_item(pos, "mobs:hairball")
|
core.add_item(pos, "mobs:hairball")
|
||||||
|
|
||||||
minetest.sound_play("default_dig_snappy", {
|
core.sound_play("default_dig_snappy", {
|
||||||
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -132,7 +132,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
|
|
||||||
local spawn_on = "default:dirt_with_grass"
|
local spawn_on = "default:dirt_with_grass"
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") then
|
if core.get_modpath("ethereal") then
|
||||||
spawn_on = "ethereal:grove_dirt"
|
spawn_on = "ethereal:grove_dirt"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ local hairball_items = {
|
|||||||
"ethereal:fish_tetra"
|
"ethereal:fish_tetra"
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:hairball", {
|
core.register_craftitem(":mobs:hairball", {
|
||||||
description = S("Hairball"),
|
description = S("Hairball"),
|
||||||
inventory_image = "mobs_hairball.png",
|
inventory_image = "mobs_hairball.png",
|
||||||
|
|
||||||
@ -181,11 +181,11 @@ minetest.register_craftitem(":mobs:hairball", {
|
|||||||
local newpos = {x = pos.x + dir.x, y = pos.y + dir.y + 1.5, z = pos.z + dir.z}
|
local newpos = {x = pos.x + dir.x, y = pos.y + dir.y + 1.5, z = pos.z + dir.z}
|
||||||
local item = hairball_items[math.random(1, #hairball_items)]
|
local item = hairball_items[math.random(1, #hairball_items)]
|
||||||
|
|
||||||
if item ~= "" and minetest.registered_items[item] then
|
if item ~= "" and core.registered_items[item] then
|
||||||
minetest.add_item(newpos, {name = item})
|
core.add_item(newpos, {name = item})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.sound_play("default_place_node_hard", {
|
core.sound_play("default_place_node_hard", {
|
||||||
pos = newpos, gain = 1.0, max_hear_distance = 5}, true)
|
pos = newpos, gain = 1.0, max_hear_distance = 5}, true)
|
||||||
|
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
@ -25,7 +25,7 @@ lucky_block:add_blocks({
|
|||||||
|
|
||||||
-- if nyancat found add special block
|
-- if nyancat found add special block
|
||||||
|
|
||||||
if minetest.registered_nodes["default:nyancat"] then
|
if core.registered_nodes["default:nyancat"] then
|
||||||
|
|
||||||
lucky_block:add_blocks({
|
lucky_block:add_blocks({
|
||||||
{"tro", "default:nyancat", "mobs_kitten", true}
|
{"tro", "default:nyancat", "mobs_kitten", true}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- Panda by AspireMint (CC BY-SA 3.0)
|
-- Panda by AspireMint (CC BY-SA 3.0)
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ mobs:register_mob("mobs_animal:panda", {
|
|||||||
|
|
||||||
-- where to spawn (ethereal bamboo biome only)
|
-- where to spawn (ethereal bamboo biome only)
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
|
if core.get_modpath("ethereal") and not mobs.custom_spawn_animal then
|
||||||
|
|
||||||
mobs:spawn({
|
mobs:spawn({
|
||||||
name = "mobs_animal:panda",
|
name = "mobs_animal:panda",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- Penguin by D00Med
|
-- Penguin by D00Med
|
||||||
|
|
||||||
|
8
rat.lua
8
rat.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- Rat by KPavel and PilzAdam (B3D model by sirrobzeroone)
|
-- Rat by KPavel and PilzAdam (B3D model by sirrobzeroone)
|
||||||
|
|
||||||
@ -93,16 +93,16 @@ mobs:alias_mob("mobs:rat", "mobs_animal:rat")
|
|||||||
|
|
||||||
-- cooked rat, yummy!
|
-- cooked rat, yummy!
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:rat_cooked", {
|
core.register_craftitem(":mobs:rat_cooked", {
|
||||||
description = S("Cooked Rat"),
|
description = S("Cooked Rat"),
|
||||||
inventory_image = "mobs_cooked_rat.png",
|
inventory_image = "mobs_cooked_rat.png",
|
||||||
on_use = minetest.item_eat(3),
|
on_use = core.item_eat(3),
|
||||||
groups = {food_rat = 1}
|
groups = {food_rat = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:rat_cooked", 3)
|
mobs.add_eatable("mobs:rat_cooked", 3)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mobs:rat_cooked",
|
output = "mobs:rat_cooked",
|
||||||
recipe = "mobs_animal:rat",
|
recipe = "mobs_animal:rat",
|
||||||
|
28
sheep.lua
28
sheep.lua
@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
-- translation and localize function
|
-- translation and localize function
|
||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
local random = math.random
|
local random = math.random
|
||||||
|
|
||||||
-- should sheep eat grass blocks and mess up the environment?
|
-- should sheep eat grass blocks and mess up the environment?
|
||||||
|
|
||||||
local eat_gb = minetest.settings:get_bool("mobs_animal.eat_grass_block")
|
local eat_gb = core.settings:get_bool("mobs_animal.eat_grass_block")
|
||||||
local replace_what = { {"group:grass", "air", -1} }
|
local replace_what = { {"group:grass", "air", -1} }
|
||||||
|
|
||||||
if eat_gb then
|
if eat_gb then
|
||||||
@ -169,7 +169,7 @@ for _, col in ipairs(all_colours) do
|
|||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
pos.y = pos.y + 0.5 -- spawn child a little higher
|
pos.y = pos.y + 0.5 -- spawn child a little higher
|
||||||
|
|
||||||
local mob = minetest.add_entity(pos, parent1.name)
|
local mob = core.add_entity(pos, parent1.name)
|
||||||
local ent2 = mob:get_luaentity()
|
local ent2 = mob:get_luaentity()
|
||||||
|
|
||||||
-- remove horns from parents' texture string, lambs dont have horns
|
-- remove horns from parents' texture string, lambs dont have horns
|
||||||
@ -275,7 +275,7 @@ for _, col in ipairs(all_colours) do
|
|||||||
if itemname == "mobs:shears" then
|
if itemname == "mobs:shears" then
|
||||||
|
|
||||||
if self.gotten ~= false or self.child ~= false
|
if self.gotten ~= false or self.child ~= false
|
||||||
or name ~= self.owner or not minetest.get_modpath("wool") then
|
or name ~= self.owner or not core.get_modpath("wool") then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ for _, col in ipairs(all_colours) do
|
|||||||
self.drops = drops_gotten
|
self.drops = drops_gotten
|
||||||
self.food = 0 -- reset food
|
self.food = 0 -- reset food
|
||||||
|
|
||||||
local obj = minetest.add_item(
|
local obj = core.add_item(
|
||||||
self.object:get_pos(),
|
self.object:get_pos(),
|
||||||
ItemStack("wool:" .. col[1] .. " " .. random(3))
|
ItemStack("wool:" .. col[1] .. " " .. random(3))
|
||||||
)
|
)
|
||||||
@ -320,7 +320,7 @@ for _, col in ipairs(all_colours) do
|
|||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
|
||||||
-- add new coloured sheep
|
-- add new coloured sheep
|
||||||
local mob = minetest.add_entity(pos, "mobs_animal:sheep_" .. colr)
|
local mob = core.add_entity(pos, "mobs_animal:sheep_" .. colr)
|
||||||
local ent = mob:get_luaentity()
|
local ent = mob:get_luaentity()
|
||||||
|
|
||||||
if ent then
|
if ent then
|
||||||
@ -385,7 +385,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
|
|
||||||
local max_ht = 400
|
local max_ht = 400
|
||||||
local spawn_on = {"default:dirt_with_grass", "ethereal:green_dirt"}
|
local spawn_on = {"default:dirt_with_grass", "ethereal:green_dirt"}
|
||||||
local mod_ethereal = minetest.get_modpath("ethereal")
|
local mod_ethereal = core.get_modpath("ethereal")
|
||||||
local spawn_chance = mod_ethereal and 12000 or 8000
|
local spawn_chance = mod_ethereal and 12000 or 8000
|
||||||
|
|
||||||
mobs:spawn({
|
mobs:spawn({
|
||||||
@ -471,7 +471,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
random_sheep(pos, true)
|
random_sheep(pos, true)
|
||||||
|
|
||||||
-- Rest of herd
|
-- Rest of herd
|
||||||
local nods = minetest.find_nodes_in_area_under_air(
|
local nods = core.find_nodes_in_area_under_air(
|
||||||
{x = pos.x - 4, y = pos.y - 3, z = pos.z - 4},
|
{x = pos.x - 4, y = pos.y - 3, z = pos.z - 4},
|
||||||
{x = pos.x + 4, y = pos.y + 3, z = pos.z + 4}, spawn_on)
|
{x = pos.x + 4, y = pos.y + 3, z = pos.z + 4}, spawn_on)
|
||||||
|
|
||||||
@ -486,7 +486,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
|
|
||||||
pos2.y = pos2.y + 2
|
pos2.y = pos2.y + 2
|
||||||
|
|
||||||
if minetest.get_node(pos2).name == "air" then
|
if core.get_node(pos2).name == "air" then
|
||||||
|
|
||||||
-- Add a sheep or lamb
|
-- Add a sheep or lamb
|
||||||
random_sheep(pos2, false)
|
random_sheep(pos2, false)
|
||||||
@ -503,10 +503,10 @@ mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white")
|
|||||||
|
|
||||||
-- raw mutton
|
-- raw mutton
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:mutton_raw", {
|
core.register_craftitem(":mobs:mutton_raw", {
|
||||||
description = S("Raw Mutton"),
|
description = S("Raw Mutton"),
|
||||||
inventory_image = "mobs_mutton_raw.png",
|
inventory_image = "mobs_mutton_raw.png",
|
||||||
on_use = minetest.item_eat(2),
|
on_use = core.item_eat(2),
|
||||||
groups = {food_meat_raw = 1, food_mutton_raw = 1}
|
groups = {food_meat_raw = 1, food_mutton_raw = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -514,16 +514,16 @@ mobs.add_eatable("mobs:mutton_raw", 2)
|
|||||||
|
|
||||||
-- cooked mutton and recipe
|
-- cooked mutton and recipe
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:mutton_cooked", {
|
core.register_craftitem(":mobs:mutton_cooked", {
|
||||||
description = S("Cooked Mutton"),
|
description = S("Cooked Mutton"),
|
||||||
inventory_image = "mobs_mutton_cooked.png",
|
inventory_image = "mobs_mutton_cooked.png",
|
||||||
on_use = minetest.item_eat(6),
|
on_use = core.item_eat(6),
|
||||||
groups = {food_meat = 1, food_mutton = 1}
|
groups = {food_meat = 1, food_mutton = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:mutton_cooked", 6)
|
mobs.add_eatable("mobs:mutton_cooked", 6)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mobs:mutton_cooked",
|
output = "mobs:mutton_cooked",
|
||||||
recipe = "mobs:mutton_raw",
|
recipe = "mobs:mutton_raw",
|
||||||
|
14
warthog.lua
14
warthog.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
local S = minetest.get_translator("mobs_animal")
|
local S = core.get_translator("mobs_animal")
|
||||||
|
|
||||||
-- Warthog originally by KrupnoPavel, B3D model by sirrobzeroone
|
-- Warthog originally by KrupnoPavel, B3D model by sirrobzeroone
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ if not mobs.custom_spawn_animal then
|
|||||||
local spawn_on = {"default:dirt_with_grass", "default:dry_dirt_with_dry_grass"}
|
local spawn_on = {"default:dirt_with_grass", "default:dry_dirt_with_dry_grass"}
|
||||||
local spawn_by = {"group:grass"}
|
local spawn_by = {"group:grass"}
|
||||||
|
|
||||||
if minetest.get_modpath("ethereal") then
|
if core.get_modpath("ethereal") then
|
||||||
spawn_on = {"ethereal:mushroom_dirt"}
|
spawn_on = {"ethereal:mushroom_dirt"}
|
||||||
spawn_by = {"flowers:mushroom_brown", "flowers:mushroom_red"}
|
spawn_by = {"flowers:mushroom_brown", "flowers:mushroom_red"}
|
||||||
end
|
end
|
||||||
@ -92,10 +92,10 @@ mobs:alias_mob("mobs:pumba", "mobs_animal:pumba")
|
|||||||
|
|
||||||
-- raw porkchop
|
-- raw porkchop
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:pork_raw", {
|
core.register_craftitem(":mobs:pork_raw", {
|
||||||
description = S("Raw Porkchop"),
|
description = S("Raw Porkchop"),
|
||||||
inventory_image = "mobs_pork_raw.png",
|
inventory_image = "mobs_pork_raw.png",
|
||||||
on_use = minetest.item_eat(4),
|
on_use = core.item_eat(4),
|
||||||
groups = {food_meat_raw = 1, food_pork_raw = 1}
|
groups = {food_meat_raw = 1, food_pork_raw = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -103,16 +103,16 @@ mobs.add_eatable("mobs:pork_raw", 4)
|
|||||||
|
|
||||||
-- cooked porkchop and recipe
|
-- cooked porkchop and recipe
|
||||||
|
|
||||||
minetest.register_craftitem(":mobs:pork_cooked", {
|
core.register_craftitem(":mobs:pork_cooked", {
|
||||||
description = S("Cooked Porkchop"),
|
description = S("Cooked Porkchop"),
|
||||||
inventory_image = "mobs_pork_cooked.png",
|
inventory_image = "mobs_pork_cooked.png",
|
||||||
on_use = minetest.item_eat(8),
|
on_use = core.item_eat(8),
|
||||||
groups = {food_meat = 1, food_pork = 1}
|
groups = {food_meat = 1, food_pork = 1}
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs.add_eatable("mobs:pork_cooked", 8)
|
mobs.add_eatable("mobs:pork_cooked", 8)
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "cooking",
|
type = "cooking",
|
||||||
output = "mobs:pork_cooked",
|
output = "mobs:pork_cooked",
|
||||||
recipe = "mobs:pork_raw",
|
recipe = "mobs:pork_raw",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user