forked from mtcontrib/mobs_animal
change minetest. to core.
This commit is contained in:
28
sheep.lua
28
sheep.lua
@ -1,12 +1,12 @@
|
||||
|
||||
-- translation and localize function
|
||||
|
||||
local S = minetest.get_translator("mobs_animal")
|
||||
local S = core.get_translator("mobs_animal")
|
||||
local random = math.random
|
||||
|
||||
-- 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} }
|
||||
|
||||
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
|
||||
|
||||
local mob = minetest.add_entity(pos, parent1.name)
|
||||
local mob = core.add_entity(pos, parent1.name)
|
||||
local ent2 = mob:get_luaentity()
|
||||
|
||||
-- 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 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
|
||||
end
|
||||
|
||||
@ -283,7 +283,7 @@ for _, col in ipairs(all_colours) do
|
||||
self.drops = drops_gotten
|
||||
self.food = 0 -- reset food
|
||||
|
||||
local obj = minetest.add_item(
|
||||
local obj = core.add_item(
|
||||
self.object:get_pos(),
|
||||
ItemStack("wool:" .. col[1] .. " " .. random(3))
|
||||
)
|
||||
@ -320,7 +320,7 @@ for _, col in ipairs(all_colours) do
|
||||
local pos = self.object:get_pos()
|
||||
|
||||
-- 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()
|
||||
|
||||
if ent then
|
||||
@ -385,7 +385,7 @@ if not mobs.custom_spawn_animal then
|
||||
|
||||
local max_ht = 400
|
||||
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
|
||||
|
||||
mobs:spawn({
|
||||
@ -471,7 +471,7 @@ if not mobs.custom_spawn_animal then
|
||||
random_sheep(pos, true)
|
||||
|
||||
-- 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}, spawn_on)
|
||||
|
||||
@ -486,7 +486,7 @@ if not mobs.custom_spawn_animal then
|
||||
|
||||
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
|
||||
random_sheep(pos2, false)
|
||||
@ -503,10 +503,10 @@ mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white")
|
||||
|
||||
-- raw mutton
|
||||
|
||||
minetest.register_craftitem(":mobs:mutton_raw", {
|
||||
core.register_craftitem(":mobs:mutton_raw", {
|
||||
description = S("Raw Mutton"),
|
||||
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}
|
||||
})
|
||||
|
||||
@ -514,16 +514,16 @@ mobs.add_eatable("mobs:mutton_raw", 2)
|
||||
|
||||
-- cooked mutton and recipe
|
||||
|
||||
minetest.register_craftitem(":mobs:mutton_cooked", {
|
||||
core.register_craftitem(":mobs:mutton_cooked", {
|
||||
description = S("Cooked Mutton"),
|
||||
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}
|
||||
})
|
||||
|
||||
mobs.add_eatable("mobs:mutton_cooked", 6)
|
||||
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
type = "cooking",
|
||||
output = "mobs:mutton_cooked",
|
||||
recipe = "mobs:mutton_raw",
|
||||
|
Reference in New Issue
Block a user