Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2023-06-07 21:55:14 +02:00
commit b9605e9fac
21 changed files with 710 additions and 297 deletions

62
bee.lua
View File

@ -1,6 +1,7 @@
local S = mobs.intllib_animal
-- Bee by KrupnoPavel (.b3d model by sirrobzeroone)
mobs:register_mob("mobs_animal:bee", {
@ -13,18 +14,18 @@ mobs:register_mob("mobs_animal:bee", {
visual = "mesh",
mesh = "mobs_bee.b3d",
textures = {
{"mobs_bee.png"},
{"mobs_bee.png"}
},
blood_texture = "mobs_bee_inv.png",
blood_amount = 1,
makes_footstep_sound = false,
sounds = {
random = "mobs_bee",
random = "mobs_bee"
},
walk_velocity = 1,
jump = true,
drops = {
{name = "mobs:honey", chance = 2, min = 1, max = 2},
{name = "mobs:honey", chance = 2, min = 1, max = 2}
},
water_damage = 1,
lava_damage = 2,
@ -36,42 +37,50 @@ mobs:register_mob("mobs_animal:bee", {
stand_start = 0,
stand_end = 30,
walk_start = 35,
walk_end = 65,
walk_end = 65
},
on_rightclick = function(self, clicker)
mobs:capture_mob(self, clicker, 50, 90, 0, true, "mobs_animal:bee")
end,
-- after_activate = function(self, staticdata, def, dtime)
-- print ("------", self.name, dtime, self.health)
-- end,
})
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:bee",
nodes = {"group:flower"},
min_light = 14,
interval = 60,
chance = 7000,
min_height = 3,
max_height = 200,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:bee",
nodes = {"group:flower"},
min_light = 14,
interval = 60,
chance = 7000,
min_height = 3,
max_height = 200,
day_toggle = true
})
end
-- spawn egg
mobs:register_egg("mobs_animal:bee", S("Bee"), "mobs_bee_inv.png")
-- compatibility
-- compatibility (only required if moving from old mobs to mobs_redo)
mobs:alias_mob("mobs:bee", "mobs_animal:bee")
-- honey
minetest.register_craftitem(":mobs:honey", {
description = S("Honey"),
inventory_image = "mobs_honey_inv.png",
on_use = minetest.item_eat(4),
groups = {food_honey = 1, food_sugar = 1, flammable = 1},
groups = {food_honey = 1, food_sugar = 1, flammable = 1}
})
-- beehive (when placed spawns bee)
minetest.register_node(":mobs:beehive", {
description = S("Beehive"),
@ -82,14 +91,15 @@ minetest.register_node(":mobs:beehive", {
sunlight_propagates = true,
walkable = true,
groups = {oddly_breakable_by_hand = 3, flammable = 1, disable_suffocation = 1},
sounds = default.node_sound_defaults(),
sounds = default and default.node_sound_defaults(),
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local gui_bg = default and default.gui_bg .. default.gui_bg_img .. default.gui_slots or ""
meta:set_string("formspec", "size[8,6]"
..default.gui_bg..default.gui_bg_img..default.gui_slots
.. gui_bg
.. "image[3,0.8;0.8,0.8;mobs_bee_inv.png]"
.. "list[current_name;beehive;4,0.5;1,1;]"
.. "list[current_player;main;0,2.35;8,4;]"
@ -104,7 +114,7 @@ minetest.register_node(":mobs:beehive", {
minetest.set_node(pos, {name = "mobs:beehive", param2 = 1})
if math.random(1, 4) == 1 then
if math.random(4) == 1 then
minetest.add_entity(pos, "mobs_animal:bee")
end
end
@ -131,14 +141,14 @@ minetest.register_node(":mobs:beehive", {
-- only dig beehive if no honey inside
return meta:get_inventory():is_empty("beehive")
end,
end
})
-- beehive recipe
minetest.register_craft({
output = "mobs:beehive",
recipe = {
{"mobs:bee","mobs:bee","mobs:bee"},
{"mobs:bee","mobs:bee","mobs:bee"}
}
})
@ -147,25 +157,27 @@ minetest.register_node(":mobs:honey_block", {
description = S("Honey Block"),
tiles = {"mobs_honey_block.png"},
groups = {snappy = 3, flammable = 2},
sounds = default.node_sound_dirt_defaults(),
sounds = default and default.node_sound_dirt_defaults()
})
-- recipe
minetest.register_craft({
output = "mobs:honey_block",
recipe = {
{"mobs:honey", "mobs:honey", "mobs:honey"},
{"mobs:honey", "mobs:honey", "mobs:honey"},
{"mobs:honey", "mobs:honey", "mobs:honey"},
{"mobs:honey", "mobs:honey", "mobs:honey"}
}
})
minetest.register_craft({
output = "mobs:honey 9",
recipe = {
{"mobs:honey_block"},
{"mobs:honey_block"}
}
})
-- beehive workings
minetest.register_abm({
nodenames = {"mobs:beehive"},

View File

@ -5,21 +5,21 @@ local S = mobs.intllib_animal
-- Bunny by ExeterDad
mobs:register_mob("mobs_animal:bunny", {
stepheight = 0.6,
type = "animal",
passive = true,
reach = 1,
stepheight = 0.6,
hp_min = 1,
hp_max = 4,
armor = 200,
collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268},
collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268},
visual = "mesh",
mesh = "mobs_bunny.b3d",
drawtype = "front",
textures = {
{"mobs_bunny_grey.png"},
{"mobs_bunny_brown.png"},
{"mobs_bunny_white.png"},
{"mobs_bunny_white.png"}
},
sounds = {},
makes_footstep_sound = false,
@ -31,9 +31,9 @@ stepheight = 0.6,
jump_height = 6,
drops = {
{name = "mobs:rabbit_raw", chance = 1, min = 1, max = 1},
{name = "mobs:rabbit_hide", chance = 1, min = 0, max = 1},
{name = "mobs:rabbit_hide", chance = 1, min = 0, max = 1}
},
water_damage = 0,
water_damage = 0.01,
lava_damage = 4,
light_damage = 0,
fear_height = 2,
@ -44,13 +44,14 @@ stepheight = 0.6,
walk_start = 16,
walk_end = 24,
punch_start = 16,
punch_end = 24,
punch_end = 24
},
follow = {"farming:carrot", "farming_plus:carrot_item", "default:grass_1"},
view_range = 8,
replace_rate = 10,
replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
replace_with = "air",
on_rightclick = function(self, clicker)
-- feed or tame
@ -60,25 +61,44 @@ stepheight = 0.6,
-- Monty Python tribute
local item = clicker:get_wielded_item()
local player_name = clicker:get_player_name()
if item:get_name() == "mobs:lava_orb" then
if self.owner == player_name
and item:get_name() == "mobs:lava_orb" then
-- take orb
if not mobs.is_creative(clicker:get_player_name()) then
item:take_item()
clicker:set_wielded_item(item)
end
self.object:set_properties({
textures = {"mobs_bunny_evil.png"},
-- set special bunny attributes
local staticdata = minetest.serialize({
type = "monster",
attack_type = "dogfight",
hp_max = 20,
health = 20,
damage = 5,
run_velocity = 3,
passive = false,
runaway = false,
runaway_from = {},
runaway_timer = 0,
tamed = false,
base_texture = {"mobs_bunny_evil.png"}
})
self.type = "monster"
self.health = 20
self.passive = false
-- add evil bunny
local obj = minetest.add_entity(
self.object:get_pos(), "mobs_animal:bunny", staticdata)
return
-- remove old bunny
if obj:get_luaentity() then
mobs:remove(self, true)
end
end
end,
on_spawn = function(self)
local pos = self.object:get_pos() ; pos.y = pos.y - 1
@ -88,11 +108,13 @@ stepheight = 0.6,
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
self.base_texture = {"mobs_bunny_white.png"}
self.object:set_properties({textures = self.base_texture})
-- brown desert bunny
elseif minetest.find_node_near(pos, 1,
{"default:desert_sand", "default:desert_stone"}) then
self.base_texture = {"mobs_bunny_brown.png"}
self.object:set_properties({textures = self.base_texture})
-- grey stone bunny
elseif minetest.find_node_near(pos, 1,
{"default:stone", "default:gravel"}) then
@ -101,9 +123,7 @@ stepheight = 0.6,
end
return true -- run only once, false/nil runs every activation
end,
attack_type = "dogfight",
damage = 5,
end
})
@ -114,17 +134,18 @@ if minetest.get_modpath("ethereal") then
end
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:bunny",
nodes = {spawn_on},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000, -- 15000
min_height = 5,
max_height = 200,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:bunny",
nodes = {spawn_on},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000,
min_height = 5,
max_height = 200,
day_toggle = true
})
end
@ -139,7 +160,7 @@ minetest.register_craftitem(":mobs:rabbit_raw", {
description = S("Raw Rabbit"),
inventory_image = "mobs_rabbit_raw.png",
on_use = minetest.item_eat(3),
groups = {food_meat_raw = 1, food_rabbit_raw = 1, flammable = 2},
groups = {food_meat_raw = 1, food_rabbit_raw = 1, flammable = 2}
})
-- cooked rabbit
@ -147,32 +168,31 @@ minetest.register_craftitem(":mobs:rabbit_cooked", {
description = S("Cooked Rabbit"),
inventory_image = "mobs_rabbit_cooked.png",
on_use = minetest.item_eat(5),
groups = {food_meat = 1, food_rabbit = 1, flammable = 2},
groups = {food_meat = 1, food_rabbit = 1, flammable = 2}
})
minetest.register_craft({
type = "cooking",
output = "mobs:rabbit_cooked",
recipe = "mobs:rabbit_raw",
cooktime = 5,
cooktime = 5
})
-- rabbit hide
minetest.register_craftitem(":mobs:rabbit_hide", {
description = S("Rabbit Hide"),
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,
burntime = 2
})
minetest.register_craft({
output = "mobs:leather",
-- type = "shapeless",
recipe = {
{"mobs:rabbit_hide", "mobs:rabbit_hide"},
{"mobs:rabbit_hide", "mobs:rabbit_hide"}

View File

@ -5,7 +5,7 @@ local S = mobs.intllib_animal
-- Chicken by JK Murray and Sirrobzeroone
mobs:register_mob("mobs_animal:chicken", {
stepheight = 0.6,
stepheight = 0.6,
type = "animal",
passive = true,
hp_min = 5,
@ -17,14 +17,14 @@ stepheight = 0.6,
textures = {
{"mobs_chicken.png"}, -- white
{"mobs_chicken_brown.png"},
{"mobs_chicken_black.png"},
{"mobs_chicken_black.png"}
},
child_texture = {
{"mobs_chick.png"},
{"mobs_chick.png"}
},
makes_footstep_sound = true,
sounds = {
random = "mobs_chicken",
random = "mobs_chicken"
},
walk_velocity = 1,
run_velocity = 3,
@ -32,7 +32,7 @@ stepheight = 0.6,
runaway_from = {"player", "mobs_animal:pumba"},
drops = {
{name = "mobs:chicken_raw", chance = 1, min = 1, max = 1},
{name = "mobs:chicken_feather", chance = 1, min = 0, max = 2},
{name = "mobs:chicken_feather", chance = 1, min = 0, max = 2}
},
water_damage = 1,
lava_damage = 5,
@ -53,7 +53,7 @@ stepheight = 0.6,
walk_speed = 24,
run_start = 91,
run_end = 110,
run_speed = 24,
run_speed = 24
},
follow = {
"farming:seed_wheat", "farming:seed_cotton", "farming:seed_barley",
@ -77,7 +77,7 @@ stepheight = 0.6,
self.egg_timer = 0
if self.child
or math.random(1, 100) > 1 then
or math.random(100) > 1 then
return
end
@ -88,9 +88,9 @@ stepheight = 0.6,
minetest.sound_play("default_place_node_hard", {
pos = pos,
gain = 1.0,
max_hear_distance = 5,
max_hear_distance = 5
})
end,
end
})
@ -102,17 +102,18 @@ end
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:chicken",
nodes = spawn_on,
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000, -- 15000
min_height = 5,
max_height = 200,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:chicken",
nodes = spawn_on,
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000,
min_height = 5,
max_height = 200,
day_toggle = true
})
end
@ -133,14 +134,14 @@ mobs:register_arrow("mobs_animal:egg_entity", {
hit_player = function(self, player)
player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 1},
damage_groups = {fleshy = 1}
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 1},
damage_groups = {fleshy = 1}
}, nil)
end,
@ -181,7 +182,7 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
minetest.sound_play("default_place_node_hard", {
pos = playerpos,
gain = 1.0,
max_hear_distance = 5,
max_hear_distance = 5
})
local obj = minetest.add_entity({
@ -251,46 +252,46 @@ minetest.register_craftitem(":mobs:chicken_egg_fried", {
description = S("Fried Egg"),
inventory_image = "mobs_chicken_egg_fried.png",
on_use = minetest.item_eat(2),
groups = {food_egg_fried = 1, flammable = 2},
groups = {food_egg_fried = 1, flammable = 2}
})
minetest.register_craft({
type = "cooking",
recipe = "mobs:egg",
output = "mobs:chicken_egg_fried",
output = "mobs:chicken_egg_fried"
})
-- raw chicken
minetest.register_craftitem(":mobs:chicken_raw", {
description = S("Raw Chicken"),
description = S("Raw Chicken"),
inventory_image = "mobs_chicken_raw.png",
on_use = minetest.item_eat(2),
groups = {food_meat_raw = 1, food_chicken_raw = 1, flammable = 2},
groups = {food_meat_raw = 1, food_chicken_raw = 1, flammable = 2}
})
-- cooked chicken
minetest.register_craftitem(":mobs:chicken_cooked", {
description = S("Cooked Chicken"),
description = S("Cooked Chicken"),
inventory_image = "mobs_chicken_cooked.png",
on_use = minetest.item_eat(6),
groups = {food_meat = 1, food_chicken = 1, flammable = 2},
groups = {food_meat = 1, food_chicken = 1, flammable = 2}
})
minetest.register_craft({
type = "cooking",
recipe = "mobs:chicken_raw",
output = "mobs:chicken_cooked",
output = "mobs:chicken_cooked"
})
-- feather
minetest.register_craftitem(":mobs:chicken_feather", {
description = S("Feather"),
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,
burntime = 1
})

64
cow.lua
View File

@ -35,7 +35,7 @@ mobs:register_mob("mobs_animal:cow", {
{name = "mobs:leather", chance = 1, min = 0, max = 2},
{name = "maptools:silver_coin", chance = 10, min = 0, max = 1,},
},
water_damage = 0,
water_damage = 0.01,
lava_damage = 5,
light_damage = 0,
animation = {
@ -71,6 +71,7 @@ mobs:register_mob("mobs_animal:cow", {
},
-- stay_near = {{"farming:straw", "group:grass"}, 10},
fear_height = 2,
on_rightclick = function(self, clicker)
-- feed or tame
@ -93,7 +94,8 @@ mobs:register_mob("mobs_animal:cow", {
-- milk cow with empty bucket
if item == "bucket:bucket_empty"
or item == "wooden_bucket:bucket_wood_empty" then
or item == "wooden_bucket:bucket_wood_empty"
or item == "bucket_wooden:bucket_empty" then
--if self.gotten == true
if self.child == true then
@ -101,8 +103,9 @@ mobs:register_mob("mobs_animal:cow", {
end
if self.gotten == true then
minetest.chat_send_player(name,
S("Cow already milked!"))
minetest.chat_send_player(name, S("Cow already milked!"))
return
end
@ -113,7 +116,9 @@ mobs:register_mob("mobs_animal:cow", {
-- which bucket are we using
local ret_item = "mobs:bucket_milk"
if item == "wooden_bucket:bucket_wood_empty" then
if item == "wooden_bucket:bucket_wood_empty"
or item == "bucket_wooden:bucket_empty" then
ret_item = "mobs:wooden_bucket_milk"
end
@ -121,7 +126,9 @@ mobs:register_mob("mobs_animal:cow", {
clicker:get_inventory():add_item("main", ret_item)
else
local pos = self.object:get_pos()
pos.y = pos.y + 0.5
minetest.add_item(pos, {name = ret_item})
end
@ -145,17 +152,18 @@ mobs:register_mob("mobs_animal:cow", {
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:cow",
nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000,
min_height = 5,
max_height = 200,
day_toggle = true
})
mobs:spawn({
name = "mobs_animal:cow",
nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000,
min_height = 5,
max_height = 200,
day_toggle = true
})
end
@ -171,7 +179,7 @@ minetest.register_craftitem(":mobs:bucket_milk", {
inventory_image = "mobs_bucket_milk.png",
stack_max = 1,
on_use = minetest.item_eat(8, "bucket:bucket_empty"),
groups = {food_milk = 1, flammable = 3, drink = 1},
groups = {food_milk = 1, flammable = 3, drink = 1}
})
-- glass of milk
@ -179,7 +187,7 @@ minetest.register_craftitem(":mobs:glass_milk", {
description = S("Glass of Milk"),
inventory_image = "mobs_glass_milk.png",
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
groups = {food_milk_glass = 1, flammable = 3, vessel = 1, drink = 1},
groups = {food_milk_glass = 1, flammable = 3, vessel = 1, drink = 1}
})
minetest.register_craft({
@ -247,7 +255,7 @@ minetest.register_node(":mobs:cheeseblock", {
tiles = {"mobs_cheeseblock.png"},
is_ground_content = false,
groups = {oddly_breakable_by_hand = 3},
sounds = default.node_sound_dirt_defaults()
sounds = default and default.node_sound_dirt_defaults()
})
minetest.register_craft({
@ -293,14 +301,20 @@ minetest.register_craft({
burntime = "8",
})
-- check for wooden bucket mod and add compatibility
if minetest.get_modpath("wooden_bucket") then
-- check for either of the wood bucket mods and add compatibility
local wb = minetest.get_modpath("wooden_bucket")
local bw = minetest.get_modpath("bucket_wooden")
if wb or bw then
local return_item = wb and "wooden_bucket:bucket_wood_empty"
or "bucket_wooden:bucket_empty"
minetest.register_craftitem(":mobs:wooden_bucket_milk", {
description = S("Wooden Bucket of Milk"),
inventory_image = "mobs_wooden_bucket_milk.png",
stack_max = 1,
on_use = minetest.item_eat(8, "wooden_bucket:bucket_wood_empty"),
on_use = minetest.item_eat(8, return_item),
groups = {food_milk = 1, flammable = 3, drink = 1}
})
@ -311,7 +325,7 @@ if minetest.get_modpath("wooden_bucket") then
{"vessels:drinking_glass", "vessels:drinking_glass"},
{"mobs:wooden_bucket_milk", ""}
},
replacements = {{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}}
replacements = {{"mobs:wooden_bucket_milk", return_item}}
})
minetest.register_craft({
@ -319,7 +333,7 @@ if minetest.get_modpath("wooden_bucket") then
recipe = {
{"group:food_milk_glass", "group:food_milk_glass"},
{"group:food_milk_glass", "group:food_milk_glass"},
{"wooden_bucket:bucket_wood_empty", ""}
{return_item, ""}
},
replacements = {
{"group:food_milk_glass", "vessels:drinking_glass 4"}
@ -329,6 +343,6 @@ if minetest.get_modpath("wooden_bucket") then
minetest.register_craft({
output = "mobs:butter",
recipe = {{"mobs:wooden_bucket_milk", salt_item}},
replacements = {{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}}
replacements = {{"mobs:wooden_bucket_milk", return_item}}
})
end

View File

@ -8,11 +8,10 @@ else
if minetest.get_modpath("intllib") then
dofile(minetest.get_modpath("intllib") .. "/init.lua")
if intllib.make_gettext_pair then
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
S = intllib.make_gettext_pair() -- new gettext method
else
gettext = intllib.Getter() -- old text file method
S = intllib.Getter() -- old text file method
end
S = gettext
else -- boilerplate function
S = function(str, ...)
local args = {...}
@ -56,7 +55,9 @@ if mobs.custom_spawn_animal then
end
-- Lucky Blocks
dofile(path .. "lucky_block.lua")
if minetest.get_modpath("lucky_block") then
dofile(path .. "lucky_block.lua")
end
print ("[MOD] Mobs Redo Animals loaded")

View File

@ -2,18 +2,25 @@
local S = mobs.intllib_animal
local hairball = minetest.settings:get("mobs_hairball")
local kitten_types = {
{ nodes = {"farming:jackolantern_on"},
skins = {"mobs_kitten_black.png"}
}
}
-- Kitten by Jordach / BFD
mobs:register_mob("mobs_animal:kitten", {
stepheight = 0.6,
stepheight = 0.6,
type = "animal",
specific_attack = {"mobs_animal:rat"},
damage = 1,
attack_type = "dogfight",
attack_animals = true, -- so it can attack rat
attack_players = false,
reach = 1,
stepheight = 1.1,
specific_attack = {"mobs_animal:rat"},
damage = 1,
attack_type = "dogfight",
attack_animals = true, -- so it can attack rat
attack_players = false,
reach = 1,
stepheight = 1.1,
passive = false,
hp_min = 5,
hp_max = 10,
@ -26,11 +33,11 @@ stepheight = 1.1,
{"mobs_kitten_striped.png"},
{"mobs_kitten_splotchy.png"},
{"mobs_kitten_ginger.png"},
{"mobs_kitten_sandy.png"},
{"mobs_kitten_sandy.png"}
},
makes_footstep_sound = false,
sounds = {
random = "mobs_kitten",
random = "mobs_kitten"
},
walk_velocity = 0.6,
walk_chance = 15,
@ -38,9 +45,9 @@ stepheight = 1.1,
runaway = true,
jump = false,
drops = {
{name = "farming:string", chance = 1, min = 0, max = 1},
{name = "farming:string", chance = 1, min = 0, max = 1}
},
water_damage = 0,
water_damage = 0.01,
lava_damage = 5,
fear_height = 3,
animation = {
@ -59,6 +66,28 @@ stepheight = 1.1,
},
view_range = 8,
-- check surrounding nodes and spawn a specific kitten
on_spawn = function(self)
local pos = self.object:get_pos() ; pos.y = pos.y - 1
local tmp
for n = 1, #kitten_types do
tmp = kitten_types[n]
if minetest.find_node_near(pos, 1, tmp.nodes) then
self.base_texture = tmp.skins
self.object:set_properties({textures = tmp.skins})
return true
end
end
return true -- run only once, false/nil runs every activation
end,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 4, true, true) then return end
@ -92,8 +121,7 @@ stepheight = 1.1,
end
self.hairball_timer = 0
if self.child
or math.random(1, 250) > 1 then
if self.child or math.random(250) > 1 then
return
end
@ -102,11 +130,8 @@ stepheight = 1.1,
minetest.add_item(pos, "mobs:hairball")
minetest.sound_play("default_dig_snappy", {
pos = pos,
gain = 1.0,
max_hear_distance = 5,
})
end,
pos = pos, gain = 1.0, max_hear_distance = 5}, true)
end
})
@ -117,17 +142,18 @@ if minetest.get_modpath("ethereal") then
end
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:kitten",
nodes = {spawn_on},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 10000, -- 22000
min_height = 5,
max_height = 50,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:kitten",
nodes = {spawn_on},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 10000,
min_height = 5,
max_height = 50,
day_toggle = true
})
end
@ -144,7 +170,8 @@ local hairball_items = {
"default:clay_lump", "default:paper", "default:dry_grass_1", "dye:red", "",
"farming:string", "mobs:chicken_feather", "default:acacia_bush_sapling", "",
"default:bush_sapling", "default:copper_lump", "default:iron_lump", "",
"dye:black", "dye:brown", "default:obsidian_shard", "default:tin_lump"
"dye:black", "dye:brown", "default:obsidian_shard", "default:tin_lump",
"ethereal:fish_tetra"
}
minetest.register_craftitem(":mobs:hairball", {
@ -163,13 +190,10 @@ minetest.register_craftitem(":mobs:hairball", {
end
minetest.sound_play("default_place_node_hard", {
pos = newpos,
gain = 1.0,
max_hear_distance = 5,
})
pos = newpos, gain = 1.0, max_hear_distance = 5}, true)
itemstack:take_item()
return itemstack
end,
end
})

View File

@ -1,3 +1,7 @@
All my models (K Pavel) and change code on valid license The MIT License
The MIT License (MIT)
Copyright (c) 2014 Krupnov Pavel and 2016 TenPlus1
@ -20,10 +24,78 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Chicken sounds from freesounds.org under CC0
Chicken/Cow/Panda/Pig/Sheep sounds from freesounds.org under CC0
Mutton, Pork and Rabbit meat textures by Piezo_ under CC0
Cow textures by sirrobzeroone under CC0
mobs_panda_viking.png by Zlo under CC0
Models/Textures/Media by Krupnov Pavel (WTFPL)
mobs_rat.b3d
mobs_rat.png
mobs_sheep.b3d (converted to .b3d by sirrobzerrone)
mobs_stone_monster.b3d
mobs_stone_monster.png
mobs_dirt_monster.png
mobs_sand_monster.png
mobs_tree_monster.b3d
mobs_tree_monster.png
mobs_oerkki.b3d
mobs_oerkki.png
mobs_dungeon_master.b3d
mobs_dungeon_master.png
mobs_fireball.ogg
Models/Textures by Krupno Pavel (MIT)
mobs_bee.b3d (converted to .b3d by sirrobzerrone)
mobs_bee.png
mobs_pumba.b3d (converted to .b3d by sirrobzerrone)
mobs_pumba.png
Models/Textures by ExeterDad (CC0)
mobs_bunny.b3d
mobs_bunny_grey.png
mobs_bunny_brown.png
mobs_bunny_white.png
Models/Textures by JK Murray (CC0)
mobs_chicken.b3d (converted to .b3d by sirrobzerrone)
mobs_chicken.png
mobs_chicken_brown.png
mobs_chicken_black.png
mobs_chick.png
Models/Textures by sirrobzerrone (CC0)
mobs_cow.b3d
mobs_cow.png
mobs_cow2.png
Models/Textures by Jordach/BFD (WTFPL)
mobs_kitten.b3d
mobs_kitten_striped.png
mobs_kitten_splotchy.png
mobs_kitten_ginger.png
mobs_kitten_sandy.png
Sounds by lolamadeus (CC0) http://freesound.org/people/lolamadeus/sounds/196251/
mobs_kitten.ogg
Models/Textures by AspireMint (CC BY-SA 3.0)
mobs_panda.b3d
mobs_panda.png
Models/Textures by D00Med (CC BY-SA 3.0)
mobs_penguin.b3d
mobs_penguin.png
Textures by LithiumSound's Summer Field Texture Pack (CC BY-SA 4.0 NC ShareAlike International)
mobs_sheep_base.png
mobs_sheep_horns.png
mobs_sheep_shaved.png
mobs_sheep_wool.png [all edited by sirrobzeroone]
Sounds by Cyberpangolin (WTFPL) https://forum.minetest.net/viewtopic.php?t=10798
mobs_bee.ogg
mobs_spider.ogg
mobs_rat.ogg

View File

@ -1,31 +1,28 @@
lucky_block:add_blocks({
{"spw", "mobs:sheep", 5},
{"spw", "mobs:rat", 5},
{"dro", {"mobs:rat_cooked"}, 5},
{"spw", "mobs:bunny", 3},
{"nod", "mobs:honey_block", 0},
{"spw", "mobs:pumba", 5},
{"nod", "mobs:cheeseblock", 0},
{"spw", "mobs:chicken", 5},
{"dro", {"mobs:egg"}, 5},
{"spw", "mobs:cow", 5},
{"dro", {"mobs:bucket_milk", "bucket:bucket_water"}, 8},
{"spw", "mobs:kitten", 2},
{"exp"},
{"dro", {"mobs:hairball"}, 3},
{"dro", {"mobs:chicken_raw", "mobs:chicken_cooked"}, 10},
{"dro", {"mobs:pork_raw", "mobs:pork_cooked"}, 10},
{"dro", {"mobs:mutton_raw", "mobs:mutton_cooked"}, 10},
{"dro", {"mobs:meat_raw", "mobs:meat"}, 10},
{"dro", {"mobs:glass_milk"}, 5}
})
if minetest.get_modpath("lucky_block") then
if minetest.registered_nodes["default:nyancat"] then
lucky_block:add_blocks({
{"spw", "mobs:sheep", 5},
{"spw", "mobs:rat", 5},
{"dro", {"mobs:rat_cooked"}, 5},
{"spw", "mobs:bunny", 3},
{"nod", "mobs:honey_block", 0},
{"spw", "mobs:pumba", 5},
{"nod", "mobs:cheeseblock", 0},
{"spw", "mobs:chicken", 5},
{"dro", {"mobs:egg"}, 5},
{"spw", "mobs:cow", 5},
{"dro", {"mobs:bucket_milk", "bucket:bucket_water"}, 8},
{"spw", "mobs:kitten", 2},
{"exp"},
{"dro", {"mobs:hairball"}, 3},
{"dro", {"mobs:chicken_raw", "mobs:chicken_cooked"}, 10},
{"dro", {"mobs:pork_raw", "mobs:pork_cooked"}, 10},
{"dro", {"mobs:mutton_raw", "mobs:mutton_cooked"}, 10},
{"dro", {"mobs:meat_raw", "mobs:meat"}, 10},
{"dro", {"mobs:glass_milk"}, 5},
{"tro", "default:nyancat", "mobs_kitten", true}
})
if minetest.registered_nodes["default:nyancat"] then
lucky_block:add_blocks({
{"tro", "default:nyancat", "mobs_kitten", true},
})
end
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,7 @@
local S = mobs.intllib_animal
-- Panda by AspireMint (CC BY-SA 3.0)
mobs:register_mob("mobs_animal:panda", {
@ -20,12 +21,12 @@ stepheight = 0.6,
visual = "mesh",
mesh = "mobs_panda.b3d",
textures = {
{"mobs_panda.png"},
{"mobs_panda.png"}
},
makes_footstep_sound = true,
sounds = {
random = "mobs_panda",
attack = "mobs_panda",
attack = "mobs_panda"
},
walk_chance = 5,
walk_velocity = 0.5,
@ -35,9 +36,9 @@ stepheight = 0.6,
follow = {"ethereal:bamboo", "bamboo:trunk"},
view_range = 8,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
{name = "mobs:meat_raw", chance = 1, min = 1, max = 2}
},
water_damage = 0,
water_damage = 0.01,
lava_damage = 5,
light_damage = 0,
fear_height = 6,
@ -59,14 +60,16 @@ stepheight = 0.6,
punch_end = 120,
-- 0 = rest, 1 = hiding (covers eyes), 2 = surprised
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 20, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 5, 50, false, nil) then return end
end,
end
})
if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
mobs:spawn({
@ -75,11 +78,12 @@ if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000, -- 15000
chance = 8000,
min_height = 10,
max_height = 80,
day_toggle = true,
day_toggle = true
})
end
mobs:register_egg("mobs_animal:panda", S("Panda"), "mobs_panda_inv.png")

View File

@ -1,6 +1,7 @@
local S = mobs.intllib_animal
-- Penguin by D00Med
mobs:register_mob("mobs_animal:penguin", {
@ -16,7 +17,7 @@ stepheight = 0.6,
mesh = "mobs_penguin.b3d",
visual_size = {x = 0.25, y = 0.25},
textures = {
{"mobs_penguin.png"},
{"mobs_penguin.png"}
},
sounds = {},
makes_footstep_sound = true,
@ -26,7 +27,7 @@ stepheight = 0.6,
jump = false,
stepheight = 1.1,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1}
},
water_damage = 0,
lava_damage = 4,
@ -39,7 +40,7 @@ stepheight = 0.6,
walk_start = 25,
walk_end = 45,
fly_start = 75, -- swim animation
fly_end = 95,
fly_end = 95
-- 50-70 is slide/water idle
},
fly_in = {"default:water_source", "default:water_flowing"},
@ -57,20 +58,23 @@ stepheight = 0.6,
if mobs:feed_tame(self, clicker, 4, false, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 5, 50, 80, false, nil) then return end
end,
end
})
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:penguin",
nodes = {"default:snowblock"},
min_light = 14,
interval = 60,
chance = 20000,
min_height = 0,
max_height = 200,
day_toggle = true,
})
mobs:spawn({
name = "mobs_animal:penguin",
nodes = {"default:snowblock"},
min_light = 14,
interval = 60,
chance = 20000,
min_height = 0,
max_height = 200,
day_toggle = true
})
end
mobs:register_egg("mobs_animal:penguin", S("Penguin"), "mobs_penguin_inv.png")

31
rat.lua
View File

@ -1,7 +1,8 @@
local S = mobs.intllib_animal
-- Rat by PilzAdam (B3D model by sirrobzeroone)
-- Rat by KPavel and PilzAdam (B3D model by sirrobzeroone)
mobs:register_mob("mobs_animal:rat", {
stepheight = 0.6,
@ -15,11 +16,11 @@ stepheight = 0.6,
mesh = "mobs_rat.b3d",
textures = {
{"mobs_rat.png"},
{"mobs_rat2.png"},
{"mobs_rat2.png"}
},
makes_footstep_sound = false,
sounds = {
random = "mobs_rat",
random = "mobs_rat"
},
walk_velocity = 1,
run_velocity = 2,
@ -29,6 +30,7 @@ stepheight = 0.6,
lava_damage = 4,
light_damage = 0,
fear_height = 2,
on_rightclick = function(self, clicker)
mobs:capture_mob(self, clicker, 50, 90, 0, true, "mobs_animal:rat")
end,
@ -59,6 +61,7 @@ stepheight = 0.6,
})
-- example on_spawn function
local function rat_spawn(self, pos)
self = self:get_luaentity()
print (self.name, pos.x, pos.y, pos.z)
@ -66,17 +69,19 @@ local function rat_spawn(self, pos)
self.health = 100
end
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:rat",
nodes = {"default:stone"},
min_light = 3,
max_light = 9,
interval = 60,
chance = 8000,
max_height = 0,
-- on_spawn = rat_spawn,
})
mobs:spawn({
name = "mobs_animal:rat",
nodes = {"default:stone"},
min_light = 3,
max_light = 9,
interval = 60,
chance = 8000,
max_height = 0,
-- on_spawn = rat_spawn,
})
end

View File

@ -25,7 +25,7 @@ Typically found around stone they can be picked up and cooked for eating.
---
### Sheep
Green grass and wheat munchers that can be clipped using shears to give 1-3 wool. Feed sheep 8x wheat to regrow wool, tame and breed. Right-click a tamed sheep with dye to change it's colour. Will drop 1-3 raw mutton when killed.
Green grass and wheat munchers that can be clipped using shears to give 1-3 wool when tamed. Feed sheep 8x wheat to regrow wool, tame and breed. Right-click a tamed sheep with dye to change it's colour. Will drop 1-3 raw mutton when killed.
---
### Warthog

385
sheep.lua
View File

@ -1,30 +1,63 @@
local S = mobs.intllib_animal
local random = math.random
local all_colours = {
{"black", S("Black"), "#000000b0"},
{"black", S("Black"), "#212121b0"}, -- referenced down in mobs:spawn
{"blue", S("Blue"), "#015dbb70"},
{"brown", S("Brown"), "#663300a0"},
{"cyan", S("Cyan"), "#01ffd870"},
{"brown", S("Brown"), "#663300a0"}, -- referenced down in mobs:spawn
{"cyan", S("Cyan"), "#00b4bf70"},
{"dark_green", S("Dark Green"), "#005b0770"},
{"dark_grey", S("Dark Grey"), "#303030b0"},
{"dark_grey", S("Dark Grey"), "#444444b0"}, -- referenced down in mobs:spawn
{"green", S("Green"), "#61ff0170"},
{"grey", S("Grey"), "#5b5b5bb0"},
{"magenta", S("Magenta"), "#ff05bb70"},
{"grey", S("Grey"), "#919191b0"}, -- referenced down in mobs:spawn
{"magenta", S("Magenta"), "#ed03ad70"},
{"orange", S("Orange"), "#ff840170"},
{"pink", S("Pink"), "#ff65b570"},
{"pink", S("Pink"), "#ff85c470"},
{"red", S("Red"), "#ff0000a0"},
{"violet", S("Violet"), "#2000c970"},
{"white", S("White"), "#abababc0"},
{"yellow", S("Yellow"), "#e3ff0070"}
{"violet", S("Violet"), "#5c00c970"},
{"white", S("White"), "#ffffffc0"}, -- referenced down in mobs:spawn
{"yellow", S("Yellow"), "#fff80070"}
}
-- Sheep by PilzAdam, texture converted to minetest by AMMOnym from Summerfield pack
-- Sheep by PilzAdam/K Pavel, texture converted to minetest by AMMOnym from Summerfield pack
for _, col in ipairs(all_colours) do
mobs:register_mob("mobs_animal:sheep_"..col[1], {
local drops_normal = {
{name = "mobs:mutton_raw", chance = 1, min = 1, max = 2},
{name = "wool:" .. col[1], chance = 1, min = 1, max = 1}
}
local drops_gotten = {
{name = "mobs:mutton_raw", chance = 1, min = 1, max = 2}
}
local function horn_texture_sel(horns, gotten, colr)
local base_text = "mobs_sheep_base.png"
local wool_shave_text = "mobs_sheep_wool.png"
local shav_text = "mobs_sheep_shaved.png"
local horn_text = "mobs_sheep_horns.png"
local col_override = colr and colr or col[3]
local col_text = "^[multiply:" .. col_override
if gotten then
wool_shave_text = shav_text
col_text = ""
end
-- results in unneccesary brackets for shaved but these are ignored by engine
local textures = base_text .. "^(" .. wool_shave_text .. col_text .. ")"
if horns then
textures = base_text .. "^" .. horn_text .. "^(" .. wool_shave_text
.. col_text .. ")"
end
return textures
end
mobs:register_mob("mobs_animal:sheep_" .. col[1], {
stay_near = {"farming:straw", 10},
stepheight = 0.6,
type = "animal",
@ -36,10 +69,9 @@ for _, col in ipairs(all_colours) do
visual = "mesh",
mesh = "mobs_sheep.b3d",
textures = {
{"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"}
{"mobs_sheep_base.png^(mobs_sheep_wool.png^[multiply:" .. col[3] .. ")"}
},
gotten_texture = {"mobs_sheep_shaved.png"},
gotten_mesh = "mobs_sheep_shaved.b3d",
gotten_texture = {"mobs_sheep_base.png^mobs_sheep_shaved.png"},
makes_footstep_sound = true,
sounds = {
random = "mobs_sheep"
@ -50,11 +82,8 @@ for _, col in ipairs(all_colours) do
jump = true,
jump_height = 6,
pushable = true,
drops = {
{name = "mobs:mutton_raw", chance = 1, min = 1, max = 2},
{name = "wool:"..col[1], chance = 1, min = 1, max = 1}
},
water_damage = 0,
drops = drops_normal,
water_damage = 0.01,
lava_damage = 5,
light_damage = 0,
animation = {
@ -64,7 +93,6 @@ for _, col in ipairs(all_colours) do
stand_end = 80,
walk_start = 81,
walk_end = 100,
die_start = 1, -- we dont have a specific death animation so we will
die_end = 2, -- re-use 2 standing frames at a speed of 1 fps and
die_speed = 1, -- have mob rotate when dying.
@ -82,6 +110,7 @@ for _, col in ipairs(all_colours) do
{"default:dirt_with_grass", "default:dirt", -2}
},
fear_height = 3,
on_replace = function(self, pos, oldnode, newnode)
self.food = (self.food or 0) + 1
@ -91,27 +120,127 @@ for _, col in ipairs(all_colours) do
self.food = 0
self.gotten = false
self.drops = drops_normal
self.object:set_properties({
textures = {"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
mesh = "mobs_sheep.b3d",
})
local textures = horn_texture_sel(self.attribute_horns, self.gotten)
self.object:set_properties({textures = {textures}})
-- base_texture must be kept up to date for static_save so horns persist
-- visually on server/game restart
self.base_texture = {textures}
end
end,
on_breed = function(parent1, parent2)
-- simple truth table P1/P2 horns/no_horns
local breed_out = {
["P1_N"] = {["P2_N"] = 5 ,["P2_H"] = 50},
["P1_H"] = {["P2_N"] = 50,["P2_H"] = 95}
}
local p1 = parent1.attribute_horns and "P1_H" or "P1_N"
local p2 = parent2.attribute_horns and "P2_H" or "P2_N"
local horn_chance = breed_out[p1][p2]
local horns = random(100) <= horn_chance
local pos = parent1.object:get_pos()
-- can't see an easy way to pass horn attribute into
-- child entity def, handle all spawning here, unfortunate
-- code replication from mobs_redo api.lua line 1497+
-- replace "self" with "parent1" and few other minor tweaks
----------------------------------------------------
pos.y = pos.y + 0.5 -- spawn child a little higher
local mob = minetest.add_entity(pos, parent1.name)
local ent2 = mob:get_luaentity()
-- remove horns from parents' texture string, lambs dont have horns
local textures = string.gsub(parent1.base_texture[1],
"%^mobs_sheep_horns.png", "")
-- using specific child texture (if found)
if parent1.child_texture then
textures = parent1.child_texture[1]
end
-- and resize to half height
mob:set_properties({
textures = {textures},
visual_size = {
x = parent1.base_size.x * .5,
y = parent1.base_size.y * .5
},
collisionbox = {
parent1.base_colbox[1] * .5,
parent1.base_colbox[2] * .5,
parent1.base_colbox[3] * .5,
parent1.base_colbox[4] * .5,
parent1.base_colbox[5] * .5,
parent1.base_colbox[6] * .5
},
selectionbox = {
parent1.base_selbox[1] * .5,
parent1.base_selbox[2] * .5,
parent1.base_selbox[3] * .5,
parent1.base_selbox[4] * .5,
parent1.base_selbox[5] * .5,
parent1.base_selbox[6] * .5
}
})
-- tamed and owned by parents' owner
ent2.child = true
ent2.tamed = true
ent2.owner = parent1.owner
ent2.attribute_horns = horns
-- stop mobs_redo api from spawning child
return false
end,
on_grown = function(self)
-- add the horns if we have horns when fully grown
local textures = horn_texture_sel(self.attribute_horns, self.gotten)
self.object:set_properties({textures = {textures}})
self.base_texture = {textures}
local pos = self.object:get_pos()
pos.y = pos.y + (self.collisionbox[2] * -1) - 0.4
self.object:set_pos(pos)
-- jump slightly when fully grown so as not to fall into ground
self.object:set_velocity({x = 0, y = 2, z = 0 })
end,
on_rightclick = function(self, clicker)
--are we feeding?
-- are we feeding?
if mobs:feed_tame(self, clicker, 8, true, true) then
if not self.child then
local textures = horn_texture_sel(self.attribute_horns, self.gotten)
self.object:set_properties({textures = {textures}})
self.base_texture = {textures}
end
--if fed 7 times then sheep regrows wool
if self.food and self.food > 6 then
self.gotten = false
self.drops = drops_normal
self.object:set_properties({
textures = {"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
mesh = "mobs_sheep.b3d"
})
local textures = horn_texture_sel(self.attribute_horns, self.gotten)
self.object:set_properties({textures = {textures}})
self.base_texture = {textures}
end
return
@ -121,7 +250,7 @@ for _, col in ipairs(all_colours) do
local itemname = item:get_name()
local name = clicker:get_player_name()
--are we giving a haircut>
-- are we giving a haircut>
if itemname == "mobs:shears" then
if self.gotten ~= false
@ -132,18 +261,19 @@ for _, col in ipairs(all_colours) do
end
self.gotten = true -- shaved
self.drops = drops_gotten
local obj = minetest.add_item(
self.object:get_pos(),
ItemStack( "wool:" .. col[1] .. " " .. math.random(1, 3) )
ItemStack("wool:" .. col[1] .. " " .. random(3))
)
if obj then
obj:setvelocity({
x = math.random(-1, 1),
obj:set_velocity({
x = random(-1, 1),
y = 5,
z = math.random(-1, 1)
z = random(-1, 1)
})
end
@ -151,15 +281,15 @@ for _, col in ipairs(all_colours) do
clicker:set_wielded_item(item)
self.object:set_properties({
textures = {"mobs_sheep_shaved.png"},
mesh = "mobs_sheep_shaved.b3d",
})
local textures = horn_texture_sel(self.attribute_horns, self.gotten)
self.object:set_properties({textures = {textures}})
self.base_texture = {textures}
return
end
--are we coloring?
-- are we coloring?
if itemname:find("dye:") then
if self.gotten == false
@ -171,25 +301,48 @@ for _, col in ipairs(all_colours) do
for _,c in pairs(all_colours) do
if c[1] == colr then
-- only dye if colour option available and sheep not same colour
if c[1] == colr
and self.name ~= "mobs_animal:sheep_" .. colr then
local pos = self.object:get_pos()
self.object:remove()
-- add new coloured sheep
local mob = minetest.add_entity(pos, "mobs_animal:sheep_" .. colr)
local ent = mob:get_luaentity()
ent.owner = name
ent.tamed = true
if ent then
-- take item
if not mobs.is_creative(clicker:get_player_name()) then
item:take_item()
clicker:set_wielded_item(item)
-- add old sheep attributes
ent.attribute_horns = self.attribute_horns
ent.nametag = self.nametag
ent.owner = name
ent.tamed = true
ent.protected = self.protected
ent.fire_damage = self.fire_damage
-- set sheep texture with colour override since we're
-- calling function inside different sheep
local textures = horn_texture_sel(
self.attribute_horns, false, colr)
ent.base_texture = {textures}
ent.object:set_properties({
textures = {textures},
nametag = self.nametag
})
-- remove old sheep
self.object:remove()
-- take item
if not mobs.is_creative(clicker:get_player_name()) then
item:take_item()
clicker:set_wielded_item(item)
end
break
end
break
end
end
end
@ -205,26 +358,126 @@ for _, col in ipairs(all_colours) do
end
})
mobs:register_egg("mobs_animal:sheep_"..col[1], S("@1 Sheep", col[2]), "wool_"..col[1]..".png^mobs_sheep_inv.png")
-- spawn egg
mobs:register_egg("mobs_animal:sheep_"..col[1], S("@1 Sheep", col[2]),
"wool_" .. col[1] .. ".png^mobs_sheep_inv.png")
-- compatibility
mobs:alias_mob("mobs:sheep_" .. col[1], "mobs_animal:sheep_" .. col[1])
end
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:sheep_white",
nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 8000, -- 15000
min_height = 0,
max_height = 200,
day_toggle = true
})
local max_ht = 400
local spawn_on = {"default:dirt_with_grass", "ethereal:green_dirt"}
local mod_ethereal = minetest.get_modpath("ethereal")
local spawn_chance = mod_ethereal and 12000 or 8000
mobs:spawn({
name = "mobs_animal:sheep_white",
nodes = spawn_on,
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = spawn_chance,
min_height = 0,
max_height = max_ht,
day_toggle = true,
active_object_count = 3,
-- custom function to spawn sheep herds around main mob
on_spawn = function(self, pos)
local nat_colors = {-- reference for all_colours table
["white"] = 14,
["grey"] = 8,
["dark_grey"] = 6,
["black"] = 1,
["brown"] = 3
}
local function random_sheep(pos, first)
local types = "white"
local color = all_colours[nat_colors["white"]][3]
-- Random colour selection
-- black(1/8), brown(1/16), dark_grey(1/32), grey(1/32), 6/8 white
local ran_col = random(32)
if ran_col <= 8 then
if ran_col == 1 then
types = "dark_grey"
elseif ran_col == 2 then
types = "grey"
elseif ran_col >= 3 and ran_col <= 4 then
types = "brown"
else
types = "black"
end
end
-- 1/4 chance of lamb
local lamb
if not first then
lamb = random(4) == 1
end
-- store returned entity data from mobs:add_mob, "nil" indicates the
-- rules in mobs:add_mob stopped mob from being spawned/created.
local entity = mobs:add_mob(pos,
{name = "mobs_animal:sheep_" .. types, child = lamb})
if entity and not lamb then
-- Set horns attribute, lower height will be rarer.
-- This wont affect mobs spawned by egg those only spawn hornless sheep.
local horns = random(max_ht) <= pos.y
if horns then
local text = "mobs_sheep_base.png^mobs_sheep_horns.png"
.."^(mobs_sheep_wool.png^[multiply:"
.. all_colours[nat_colors[types]][3] .. ")"
entity.object:set_properties({textures = {text}})
entity.base_texture = {text}
entity.attribute_horns = horns
end
end
end
-- First Sheep, Randomize color/horns
self.object:remove()
random_sheep(pos, true)
-- Rest of herd
local nods = minetest.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)
if nods and #nods > 0 then
-- min herd of 3
local iter = math.min(#nods, 3)
for n = 1, iter do
local pos2 = nods[random(#nods)]
pos2.y = pos2.y + 2
if minetest.get_node(pos2).name == "air" then
-- Add a sheep or lamb
random_sheep(pos2, false)
end
end
end
end
})
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 983 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -1,6 +1,7 @@
local S = mobs.intllib_animal
-- Warthog originally by KrupnoPavel, B3D model by sirrobzeroone
mobs:register_mob("mobs_animal:pumba", {
@ -38,7 +39,7 @@ mobs:register_mob("mobs_animal:pumba", {
{name = "mobs:pork_raw", chance = 1, min = 1, max = 3},
{name = "maptools:silver_coin", chance = 10, min = 0, max = 1}
},
water_damage = 0,
water_damage = 0.01,
lava_damage = 5,
light_damage = 0,
fear_height = 2,
@ -57,6 +58,7 @@ mobs:register_mob("mobs_animal:pumba", {
die_loop = false,
die_rotate = true
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then return end
@ -65,6 +67,7 @@ mobs:register_mob("mobs_animal:pumba", {
end
})
local spawn_on = {"default:dirt_with_grass"}
local spawn_by = {"group:grass"}
@ -79,19 +82,22 @@ if minetest.get_modpath("ethereal") then
end
if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:pumba",
nodes = spawn_on,
neighbors = spawn_by,
min_light = 14,
interval = 60,
chance = 8000, -- 15000
min_height = 0,
max_height = 200,
day_toggle = true
})
mobs:spawn({
name = "mobs_animal:pumba",
nodes = spawn_on,
neighbors = spawn_by,
min_light = 14,
interval = 60,
chance = 8000,
min_height = 0,
max_height = 200,
day_toggle = true
})
end
-- spawn egg
mobs:register_egg("mobs_animal:pumba", S("Warthog"), "mobs_pumba_inv.png")