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

View File

@ -5,21 +5,21 @@ local S = mobs.intllib_animal
-- Bunny by ExeterDad -- Bunny by ExeterDad
mobs:register_mob("mobs_animal:bunny", { mobs:register_mob("mobs_animal:bunny", {
stepheight = 0.6,
type = "animal", type = "animal",
passive = true, passive = true,
reach = 1, reach = 1,
stepheight = 0.6,
hp_min = 1, hp_min = 1,
hp_max = 4, hp_max = 4,
armor = 200, 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", visual = "mesh",
mesh = "mobs_bunny.b3d", mesh = "mobs_bunny.b3d",
drawtype = "front", drawtype = "front",
textures = { textures = {
{"mobs_bunny_grey.png"}, {"mobs_bunny_grey.png"},
{"mobs_bunny_brown.png"}, {"mobs_bunny_brown.png"},
{"mobs_bunny_white.png"}, {"mobs_bunny_white.png"}
}, },
sounds = {}, sounds = {},
makes_footstep_sound = false, makes_footstep_sound = false,
@ -31,9 +31,9 @@ stepheight = 0.6,
jump_height = 6, jump_height = 6,
drops = { drops = {
{name = "mobs:rabbit_raw", chance = 1, min = 1, max = 1}, {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, lava_damage = 4,
light_damage = 0, light_damage = 0,
fear_height = 2, fear_height = 2,
@ -44,13 +44,14 @@ stepheight = 0.6,
walk_start = 16, walk_start = 16,
walk_end = 24, walk_end = 24,
punch_start = 16, punch_start = 16,
punch_end = 24, punch_end = 24
}, },
follow = {"farming:carrot", "farming_plus:carrot_item", "default:grass_1"}, follow = {"farming:carrot", "farming_plus:carrot_item", "default:grass_1"},
view_range = 8, view_range = 8,
replace_rate = 10, replace_rate = 10,
replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"}, replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
replace_with = "air", replace_with = "air",
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
-- feed or tame -- feed or tame
@ -60,25 +61,44 @@ stepheight = 0.6,
-- Monty Python tribute -- Monty Python tribute
local item = clicker:get_wielded_item() 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 if not mobs.is_creative(clicker:get_player_name()) then
item:take_item() item:take_item()
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end end
self.object:set_properties({ -- set special bunny attributes
textures = {"mobs_bunny_evil.png"}, 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" -- add evil bunny
self.health = 20 local obj = minetest.add_entity(
self.passive = false self.object:get_pos(), "mobs_animal:bunny", staticdata)
return -- remove old bunny
if obj:get_luaentity() then
mobs:remove(self, true)
end
end end
end, end,
on_spawn = function(self) on_spawn = function(self)
local pos = self.object:get_pos() ; pos.y = pos.y - 1 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 {"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 minetest.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 minetest.find_node_near(pos, 1,
{"default:stone", "default:gravel"}) then {"default:stone", "default:gravel"}) then
@ -101,9 +123,7 @@ stepheight = 0.6,
end end
return true -- run only once, false/nil runs every activation return true -- run only once, false/nil runs every activation
end, end
attack_type = "dogfight",
damage = 5,
}) })
@ -114,17 +134,18 @@ if minetest.get_modpath("ethereal") then
end end
if not mobs.custom_spawn_animal then if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:bunny", mobs:spawn({
nodes = {spawn_on}, name = "mobs_animal:bunny",
neighbors = {"group:grass"}, nodes = {spawn_on},
min_light = 14, neighbors = {"group:grass"},
interval = 60, min_light = 14,
chance = 8000, -- 15000 interval = 60,
min_height = 5, chance = 8000,
max_height = 200, min_height = 5,
day_toggle = true, max_height = 200,
}) day_toggle = true
})
end end
@ -139,7 +160,7 @@ minetest.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 = 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 -- cooked rabbit
@ -147,32 +168,31 @@ minetest.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 = 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({ minetest.register_craft({
type = "cooking", type = "cooking",
output = "mobs:rabbit_cooked", output = "mobs:rabbit_cooked",
recipe = "mobs:rabbit_raw", recipe = "mobs:rabbit_raw",
cooktime = 5, cooktime = 5
}) })
-- rabbit hide -- rabbit hide
minetest.register_craftitem(":mobs:rabbit_hide", { minetest.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({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "mobs:rabbit_hide", recipe = "mobs:rabbit_hide",
burntime = 2, burntime = 2
}) })
minetest.register_craft({ minetest.register_craft({
output = "mobs:leather", output = "mobs:leather",
-- type = "shapeless",
recipe = { recipe = {
{"mobs:rabbit_hide", "mobs:rabbit_hide"}, {"mobs:rabbit_hide", "mobs:rabbit_hide"},
{"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 -- Chicken by JK Murray and Sirrobzeroone
mobs:register_mob("mobs_animal:chicken", { mobs:register_mob("mobs_animal:chicken", {
stepheight = 0.6, stepheight = 0.6,
type = "animal", type = "animal",
passive = true, passive = true,
hp_min = 5, hp_min = 5,
@ -17,14 +17,14 @@ stepheight = 0.6,
textures = { textures = {
{"mobs_chicken.png"}, -- white {"mobs_chicken.png"}, -- white
{"mobs_chicken_brown.png"}, {"mobs_chicken_brown.png"},
{"mobs_chicken_black.png"}, {"mobs_chicken_black.png"}
}, },
child_texture = { child_texture = {
{"mobs_chick.png"}, {"mobs_chick.png"}
}, },
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
random = "mobs_chicken", random = "mobs_chicken"
}, },
walk_velocity = 1, walk_velocity = 1,
run_velocity = 3, run_velocity = 3,
@ -32,7 +32,7 @@ stepheight = 0.6,
runaway_from = {"player", "mobs_animal:pumba"}, runaway_from = {"player", "mobs_animal:pumba"},
drops = { drops = {
{name = "mobs:chicken_raw", chance = 1, min = 1, max = 1}, {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, water_damage = 1,
lava_damage = 5, lava_damage = 5,
@ -53,7 +53,7 @@ stepheight = 0.6,
walk_speed = 24, walk_speed = 24,
run_start = 91, run_start = 91,
run_end = 110, run_end = 110,
run_speed = 24, run_speed = 24
}, },
follow = { follow = {
"farming:seed_wheat", "farming:seed_cotton", "farming:seed_barley", "farming:seed_wheat", "farming:seed_cotton", "farming:seed_barley",
@ -77,7 +77,7 @@ stepheight = 0.6,
self.egg_timer = 0 self.egg_timer = 0
if self.child if self.child
or math.random(1, 100) > 1 then or math.random(100) > 1 then
return return
end end
@ -88,9 +88,9 @@ stepheight = 0.6,
minetest.sound_play("default_place_node_hard", { minetest.sound_play("default_place_node_hard", {
pos = pos, pos = pos,
gain = 1.0, 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 if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:chicken", mobs:spawn({
nodes = spawn_on, name = "mobs_animal:chicken",
neighbors = {"group:grass"}, nodes = spawn_on,
min_light = 14, neighbors = {"group:grass"},
interval = 60, min_light = 14,
chance = 8000, -- 15000 interval = 60,
min_height = 5, chance = 8000,
max_height = 200, min_height = 5,
day_toggle = true, max_height = 200,
}) day_toggle = true
})
end end
@ -133,14 +134,14 @@ 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(minetest.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)
end, end,
hit_mob = function(self, player) hit_mob = function(self, player)
player:punch(self.object, 1.0, { player:punch(self.object, 1.0, {
full_punch_interval = 1.0, full_punch_interval = 1.0,
damage_groups = {fleshy = 1}, damage_groups = {fleshy = 1}
}, nil) }, nil)
end, end,
@ -181,7 +182,7 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
minetest.sound_play("default_place_node_hard", { minetest.sound_play("default_place_node_hard", {
pos = playerpos, pos = playerpos,
gain = 1.0, gain = 1.0,
max_hear_distance = 5, max_hear_distance = 5
}) })
local obj = minetest.add_entity({ local obj = minetest.add_entity({
@ -251,46 +252,46 @@ minetest.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 = minetest.item_eat(2),
groups = {food_egg_fried = 1, flammable = 2}, groups = {food_egg_fried = 1, flammable = 2}
}) })
minetest.register_craft({ minetest.register_craft({
type = "cooking", type = "cooking",
recipe = "mobs:egg", recipe = "mobs:egg",
output = "mobs:chicken_egg_fried", output = "mobs:chicken_egg_fried"
}) })
-- raw chicken -- raw chicken
minetest.register_craftitem(":mobs:chicken_raw", { minetest.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 = 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 -- cooked chicken
minetest.register_craftitem(":mobs:chicken_cooked", { minetest.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 = 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({ minetest.register_craft({
type = "cooking", type = "cooking",
recipe = "mobs:chicken_raw", recipe = "mobs:chicken_raw",
output = "mobs:chicken_cooked", output = "mobs:chicken_cooked"
}) })
-- feather -- feather
minetest.register_craftitem(":mobs:chicken_feather", { minetest.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({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "mobs:chicken_feather", 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 = "mobs:leather", chance = 1, min = 0, max = 2},
{name = "maptools:silver_coin", chance = 10, min = 0, max = 1,}, {name = "maptools:silver_coin", chance = 10, min = 0, max = 1,},
}, },
water_damage = 0, water_damage = 0.01,
lava_damage = 5, lava_damage = 5,
light_damage = 0, light_damage = 0,
animation = { animation = {
@ -71,6 +71,7 @@ mobs:register_mob("mobs_animal:cow", {
}, },
-- stay_near = {{"farming:straw", "group:grass"}, 10}, -- stay_near = {{"farming:straw", "group:grass"}, 10},
fear_height = 2, fear_height = 2,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
-- feed or tame -- feed or tame
@ -93,7 +94,8 @@ mobs:register_mob("mobs_animal:cow", {
-- milk cow with empty bucket -- milk cow with empty bucket
if item == "bucket:bucket_empty" 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.gotten == true
if self.child == true then if self.child == true then
@ -101,8 +103,9 @@ mobs:register_mob("mobs_animal:cow", {
end end
if self.gotten == true then if self.gotten == true then
minetest.chat_send_player(name,
S("Cow already milked!")) minetest.chat_send_player(name, S("Cow already milked!"))
return return
end end
@ -113,7 +116,9 @@ mobs:register_mob("mobs_animal:cow", {
-- which bucket are we using -- which bucket are we using
local ret_item = "mobs:bucket_milk" 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" ret_item = "mobs:wooden_bucket_milk"
end end
@ -121,7 +126,9 @@ mobs:register_mob("mobs_animal:cow", {
clicker:get_inventory():add_item("main", ret_item) clicker:get_inventory():add_item("main", ret_item)
else else
local pos = self.object:get_pos() local pos = self.object:get_pos()
pos.y = pos.y + 0.5 pos.y = pos.y + 0.5
minetest.add_item(pos, {name = ret_item}) minetest.add_item(pos, {name = ret_item})
end end
@ -145,17 +152,18 @@ mobs:register_mob("mobs_animal:cow", {
if not mobs.custom_spawn_animal then if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:cow", mobs:spawn({
nodes = {"default:dirt_with_grass", "ethereal:green_dirt"}, name = "mobs_animal:cow",
neighbors = {"group:grass"}, nodes = {"default:dirt_with_grass", "ethereal:green_dirt"},
min_light = 14, neighbors = {"group:grass"},
interval = 60, min_light = 14,
chance = 8000, interval = 60,
min_height = 5, chance = 8000,
max_height = 200, min_height = 5,
day_toggle = true max_height = 200,
}) day_toggle = true
})
end end
@ -171,7 +179,7 @@ minetest.register_craftitem(":mobs:bucket_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 = 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 -- glass of milk
@ -179,7 +187,7 @@ minetest.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 = 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({ minetest.register_craft({
@ -247,7 +255,7 @@ minetest.register_node(":mobs:cheeseblock", {
tiles = {"mobs_cheeseblock.png"}, tiles = {"mobs_cheeseblock.png"},
is_ground_content = false, is_ground_content = false,
groups = {oddly_breakable_by_hand = 3}, groups = {oddly_breakable_by_hand = 3},
sounds = default.node_sound_dirt_defaults() sounds = default and default.node_sound_dirt_defaults()
}) })
minetest.register_craft({ minetest.register_craft({
@ -293,14 +301,20 @@ minetest.register_craft({
burntime = "8", burntime = "8",
}) })
-- check for wooden bucket mod and add compatibility -- check for either of the wood bucket mods and add compatibility
if minetest.get_modpath("wooden_bucket") then 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", { minetest.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, "wooden_bucket:bucket_wood_empty"), on_use = minetest.item_eat(8, return_item),
groups = {food_milk = 1, flammable = 3, drink = 1} 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"}, {"vessels:drinking_glass", "vessels:drinking_glass"},
{"mobs:wooden_bucket_milk", ""} {"mobs:wooden_bucket_milk", ""}
}, },
replacements = {{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"}} replacements = {{"mobs:wooden_bucket_milk", return_item}}
}) })
minetest.register_craft({ minetest.register_craft({
@ -319,7 +333,7 @@ if minetest.get_modpath("wooden_bucket") then
recipe = { recipe = {
{"group:food_milk_glass", "group:food_milk_glass"}, {"group:food_milk_glass", "group:food_milk_glass"},
{"group:food_milk_glass", "group:food_milk_glass"}, {"group:food_milk_glass", "group:food_milk_glass"},
{"wooden_bucket:bucket_wood_empty", ""} {return_item, ""}
}, },
replacements = { replacements = {
{"group:food_milk_glass", "vessels:drinking_glass 4"} {"group:food_milk_glass", "vessels:drinking_glass 4"}
@ -329,6 +343,6 @@ if minetest.get_modpath("wooden_bucket") then
minetest.register_craft({ minetest.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", "wooden_bucket:bucket_wood_empty"}} replacements = {{"mobs:wooden_bucket_milk", return_item}}
}) })
end end

View File

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

View File

@ -2,18 +2,25 @@
local S = mobs.intllib_animal local S = mobs.intllib_animal
local hairball = minetest.settings:get("mobs_hairball") local hairball = minetest.settings:get("mobs_hairball")
local kitten_types = {
{ nodes = {"farming:jackolantern_on"},
skins = {"mobs_kitten_black.png"}
}
}
-- Kitten by Jordach / BFD -- Kitten by Jordach / BFD
mobs:register_mob("mobs_animal:kitten", { mobs:register_mob("mobs_animal:kitten", {
stepheight = 0.6, stepheight = 0.6,
type = "animal", type = "animal",
specific_attack = {"mobs_animal:rat"}, specific_attack = {"mobs_animal:rat"},
damage = 1, damage = 1,
attack_type = "dogfight", attack_type = "dogfight",
attack_animals = true, -- so it can attack rat attack_animals = true, -- so it can attack rat
attack_players = false, attack_players = false,
reach = 1, reach = 1,
stepheight = 1.1, stepheight = 1.1,
passive = false, passive = false,
hp_min = 5, hp_min = 5,
hp_max = 10, hp_max = 10,
@ -26,11 +33,11 @@ stepheight = 1.1,
{"mobs_kitten_striped.png"}, {"mobs_kitten_striped.png"},
{"mobs_kitten_splotchy.png"}, {"mobs_kitten_splotchy.png"},
{"mobs_kitten_ginger.png"}, {"mobs_kitten_ginger.png"},
{"mobs_kitten_sandy.png"}, {"mobs_kitten_sandy.png"}
}, },
makes_footstep_sound = false, makes_footstep_sound = false,
sounds = { sounds = {
random = "mobs_kitten", random = "mobs_kitten"
}, },
walk_velocity = 0.6, walk_velocity = 0.6,
walk_chance = 15, walk_chance = 15,
@ -38,9 +45,9 @@ stepheight = 1.1,
runaway = true, runaway = true,
jump = false, jump = false,
drops = { 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, lava_damage = 5,
fear_height = 3, fear_height = 3,
animation = { animation = {
@ -59,6 +66,28 @@ stepheight = 1.1,
}, },
view_range = 8, 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) on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 4, true, true) then return end if mobs:feed_tame(self, clicker, 4, true, true) then return end
@ -92,8 +121,7 @@ stepheight = 1.1,
end end
self.hairball_timer = 0 self.hairball_timer = 0
if self.child if self.child or math.random(250) > 1 then
or math.random(1, 250) > 1 then
return return
end end
@ -102,11 +130,8 @@ stepheight = 1.1,
minetest.add_item(pos, "mobs:hairball") minetest.add_item(pos, "mobs:hairball")
minetest.sound_play("default_dig_snappy", { minetest.sound_play("default_dig_snappy", {
pos = pos, pos = pos, gain = 1.0, max_hear_distance = 5}, true)
gain = 1.0, end
max_hear_distance = 5,
})
end,
}) })
@ -117,17 +142,18 @@ if minetest.get_modpath("ethereal") then
end end
if not mobs.custom_spawn_animal then if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:kitten", mobs:spawn({
nodes = {spawn_on}, name = "mobs_animal:kitten",
neighbors = {"group:grass"}, nodes = {spawn_on},
min_light = 14, neighbors = {"group:grass"},
interval = 60, min_light = 14,
chance = 10000, -- 22000 interval = 60,
min_height = 5, chance = 10000,
max_height = 50, min_height = 5,
day_toggle = true, max_height = 50,
}) day_toggle = true
})
end end
@ -144,7 +170,8 @@ local hairball_items = {
"default:clay_lump", "default:paper", "default:dry_grass_1", "dye:red", "", "default:clay_lump", "default:paper", "default:dry_grass_1", "dye:red", "",
"farming:string", "mobs:chicken_feather", "default:acacia_bush_sapling", "", "farming:string", "mobs:chicken_feather", "default:acacia_bush_sapling", "",
"default:bush_sapling", "default:copper_lump", "default:iron_lump", "", "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", { minetest.register_craftitem(":mobs:hairball", {
@ -163,13 +190,10 @@ minetest.register_craftitem(":mobs:hairball", {
end end
minetest.sound_play("default_place_node_hard", { minetest.sound_play("default_place_node_hard", {
pos = newpos, pos = newpos, gain = 1.0, max_hear_distance = 5}, true)
gain = 1.0,
max_hear_distance = 5,
})
itemstack:take_item() itemstack:take_item()
return itemstack 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) The MIT License (MIT)
Copyright (c) 2014 Krupnov Pavel and 2016 TenPlus1 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 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. 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 Mutton, Pork and Rabbit meat textures by Piezo_ under CC0
Cow textures by sirrobzeroone under CC0
mobs_panda_viking.png by Zlo 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({ lucky_block:add_blocks({
{"spw", "mobs:sheep", 5}, {"tro", "default:nyancat", "mobs_kitten", true}
{"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.registered_nodes["default:nyancat"] then
lucky_block:add_blocks({
{"tro", "default:nyancat", "mobs_kitten", true},
})
end
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 local S = mobs.intllib_animal
-- Panda by AspireMint (CC BY-SA 3.0) -- Panda by AspireMint (CC BY-SA 3.0)
mobs:register_mob("mobs_animal:panda", { mobs:register_mob("mobs_animal:panda", {
@ -20,12 +21,12 @@ stepheight = 0.6,
visual = "mesh", visual = "mesh",
mesh = "mobs_panda.b3d", mesh = "mobs_panda.b3d",
textures = { textures = {
{"mobs_panda.png"}, {"mobs_panda.png"}
}, },
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
random = "mobs_panda", random = "mobs_panda",
attack = "mobs_panda", attack = "mobs_panda"
}, },
walk_chance = 5, walk_chance = 5,
walk_velocity = 0.5, walk_velocity = 0.5,
@ -35,9 +36,9 @@ stepheight = 0.6,
follow = {"ethereal:bamboo", "bamboo:trunk"}, follow = {"ethereal:bamboo", "bamboo:trunk"},
view_range = 8, view_range = 8,
drops = { 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, lava_damage = 5,
light_damage = 0, light_damage = 0,
fear_height = 6, fear_height = 6,
@ -59,14 +60,16 @@ stepheight = 0.6,
punch_end = 120, punch_end = 120,
-- 0 = rest, 1 = hiding (covers eyes), 2 = surprised -- 0 = rest, 1 = hiding (covers eyes), 2 = surprised
}, },
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 20, true, true) then return end if mobs:feed_tame(self, clicker, 20, true, true) then return end
if mobs:protect(self, clicker) 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 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 if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
mobs:spawn({ mobs:spawn({
@ -75,11 +78,12 @@ if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
neighbors = {"group:grass"}, neighbors = {"group:grass"},
min_light = 14, min_light = 14,
interval = 60, interval = 60,
chance = 8000, -- 15000 chance = 8000,
min_height = 10, min_height = 10,
max_height = 80, max_height = 80,
day_toggle = true, day_toggle = true
}) })
end end
mobs:register_egg("mobs_animal:panda", S("Panda"), "mobs_panda_inv.png") mobs:register_egg("mobs_animal:panda", S("Panda"), "mobs_panda_inv.png")

View File

@ -1,6 +1,7 @@
local S = mobs.intllib_animal local S = mobs.intllib_animal
-- Penguin by D00Med -- Penguin by D00Med
mobs:register_mob("mobs_animal:penguin", { mobs:register_mob("mobs_animal:penguin", {
@ -16,7 +17,7 @@ stepheight = 0.6,
mesh = "mobs_penguin.b3d", mesh = "mobs_penguin.b3d",
visual_size = {x = 0.25, y = 0.25}, visual_size = {x = 0.25, y = 0.25},
textures = { textures = {
{"mobs_penguin.png"}, {"mobs_penguin.png"}
}, },
sounds = {}, sounds = {},
makes_footstep_sound = true, makes_footstep_sound = true,
@ -26,7 +27,7 @@ stepheight = 0.6,
jump = false, jump = false,
stepheight = 1.1, stepheight = 1.1,
drops = { drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1}, {name = "mobs:meat_raw", chance = 1, min = 1, max = 1}
}, },
water_damage = 0, water_damage = 0,
lava_damage = 4, lava_damage = 4,
@ -39,7 +40,7 @@ stepheight = 0.6,
walk_start = 25, walk_start = 25,
walk_end = 45, walk_end = 45,
fly_start = 75, -- swim animation fly_start = 75, -- swim animation
fly_end = 95, fly_end = 95
-- 50-70 is slide/water idle -- 50-70 is slide/water idle
}, },
fly_in = {"default:water_source", "default:water_flowing"}, 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:feed_tame(self, clicker, 4, false, true) then return end
if mobs:protect(self, clicker) 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 if mobs:capture_mob(self, clicker, 5, 50, 80, false, nil) then return end
end, end
}) })
if not mobs.custom_spawn_animal then if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:penguin", mobs:spawn({
nodes = {"default:snowblock"}, name = "mobs_animal:penguin",
min_light = 14, nodes = {"default:snowblock"},
interval = 60, min_light = 14,
chance = 20000, interval = 60,
min_height = 0, chance = 20000,
max_height = 200, min_height = 0,
day_toggle = true, max_height = 200,
}) day_toggle = true
})
end end
mobs:register_egg("mobs_animal:penguin", S("Penguin"), "mobs_penguin_inv.png") 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 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", { mobs:register_mob("mobs_animal:rat", {
stepheight = 0.6, stepheight = 0.6,
@ -15,11 +16,11 @@ stepheight = 0.6,
mesh = "mobs_rat.b3d", mesh = "mobs_rat.b3d",
textures = { textures = {
{"mobs_rat.png"}, {"mobs_rat.png"},
{"mobs_rat2.png"}, {"mobs_rat2.png"}
}, },
makes_footstep_sound = false, makes_footstep_sound = false,
sounds = { sounds = {
random = "mobs_rat", random = "mobs_rat"
}, },
walk_velocity = 1, walk_velocity = 1,
run_velocity = 2, run_velocity = 2,
@ -29,6 +30,7 @@ stepheight = 0.6,
lava_damage = 4, lava_damage = 4,
light_damage = 0, light_damage = 0,
fear_height = 2, fear_height = 2,
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
mobs:capture_mob(self, clicker, 50, 90, 0, true, "mobs_animal:rat") mobs:capture_mob(self, clicker, 50, 90, 0, true, "mobs_animal:rat")
end, end,
@ -59,6 +61,7 @@ stepheight = 0.6,
}) })
-- example on_spawn function
local function rat_spawn(self, pos) local function rat_spawn(self, pos)
self = self:get_luaentity() self = self:get_luaentity()
print (self.name, pos.x, pos.y, pos.z) print (self.name, pos.x, pos.y, pos.z)
@ -66,17 +69,19 @@ local function rat_spawn(self, pos)
self.health = 100 self.health = 100
end end
if not mobs.custom_spawn_animal then if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:rat", mobs:spawn({
nodes = {"default:stone"}, name = "mobs_animal:rat",
min_light = 3, nodes = {"default:stone"},
max_light = 9, min_light = 3,
interval = 60, max_light = 9,
chance = 8000, interval = 60,
max_height = 0, chance = 8000,
-- on_spawn = rat_spawn, max_height = 0,
}) -- on_spawn = rat_spawn,
})
end end

View File

@ -25,7 +25,7 @@ Typically found around stone they can be picked up and cooked for eating.
--- ---
### Sheep ### 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 ### Warthog

385
sheep.lua
View File

@ -1,30 +1,63 @@
local S = mobs.intllib_animal local S = mobs.intllib_animal
local random = math.random
local all_colours = { local all_colours = {
{"black", S("Black"), "#000000b0"}, {"black", S("Black"), "#212121b0"}, -- referenced down in mobs:spawn
{"blue", S("Blue"), "#015dbb70"}, {"blue", S("Blue"), "#015dbb70"},
{"brown", S("Brown"), "#663300a0"}, {"brown", S("Brown"), "#663300a0"}, -- referenced down in mobs:spawn
{"cyan", S("Cyan"), "#01ffd870"}, {"cyan", S("Cyan"), "#00b4bf70"},
{"dark_green", S("Dark Green"), "#005b0770"}, {"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"}, {"green", S("Green"), "#61ff0170"},
{"grey", S("Grey"), "#5b5b5bb0"}, {"grey", S("Grey"), "#919191b0"}, -- referenced down in mobs:spawn
{"magenta", S("Magenta"), "#ff05bb70"}, {"magenta", S("Magenta"), "#ed03ad70"},
{"orange", S("Orange"), "#ff840170"}, {"orange", S("Orange"), "#ff840170"},
{"pink", S("Pink"), "#ff65b570"}, {"pink", S("Pink"), "#ff85c470"},
{"red", S("Red"), "#ff0000a0"}, {"red", S("Red"), "#ff0000a0"},
{"violet", S("Violet"), "#2000c970"}, {"violet", S("Violet"), "#5c00c970"},
{"white", S("White"), "#abababc0"}, {"white", S("White"), "#ffffffc0"}, -- referenced down in mobs:spawn
{"yellow", S("Yellow"), "#e3ff0070"} {"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 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}, stay_near = {"farming:straw", 10},
stepheight = 0.6, stepheight = 0.6,
type = "animal", type = "animal",
@ -36,10 +69,9 @@ for _, col in ipairs(all_colours) do
visual = "mesh", visual = "mesh",
mesh = "mobs_sheep.b3d", mesh = "mobs_sheep.b3d",
textures = { 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_texture = {"mobs_sheep_base.png^mobs_sheep_shaved.png"},
gotten_mesh = "mobs_sheep_shaved.b3d",
makes_footstep_sound = true, makes_footstep_sound = true,
sounds = { sounds = {
random = "mobs_sheep" random = "mobs_sheep"
@ -50,11 +82,8 @@ for _, col in ipairs(all_colours) do
jump = true, jump = true,
jump_height = 6, jump_height = 6,
pushable = true, pushable = true,
drops = { drops = drops_normal,
{name = "mobs:mutton_raw", chance = 1, min = 1, max = 2}, water_damage = 0.01,
{name = "wool:"..col[1], chance = 1, min = 1, max = 1}
},
water_damage = 0,
lava_damage = 5, lava_damage = 5,
light_damage = 0, light_damage = 0,
animation = { animation = {
@ -64,7 +93,6 @@ for _, col in ipairs(all_colours) do
stand_end = 80, stand_end = 80,
walk_start = 81, walk_start = 81,
walk_end = 100, walk_end = 100,
die_start = 1, -- we dont have a specific death animation so we will 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_end = 2, -- re-use 2 standing frames at a speed of 1 fps and
die_speed = 1, -- have mob rotate when dying. 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} {"default:dirt_with_grass", "default:dirt", -2}
}, },
fear_height = 3, fear_height = 3,
on_replace = function(self, pos, oldnode, newnode) on_replace = function(self, pos, oldnode, newnode)
self.food = (self.food or 0) + 1 self.food = (self.food or 0) + 1
@ -91,27 +120,127 @@ for _, col in ipairs(all_colours) do
self.food = 0 self.food = 0
self.gotten = false self.gotten = false
self.drops = drops_normal
self.object:set_properties({ local textures = horn_texture_sel(self.attribute_horns, self.gotten)
textures = {"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
mesh = "mobs_sheep.b3d", 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
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) on_rightclick = function(self, clicker)
--are we feeding? -- are we feeding?
if mobs:feed_tame(self, clicker, 8, true, true) then 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 fed 7 times then sheep regrows wool
if self.food and self.food > 6 then if self.food and self.food > 6 then
self.gotten = false self.gotten = false
self.drops = drops_normal
self.object:set_properties({ local textures = horn_texture_sel(self.attribute_horns, self.gotten)
textures = {"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
mesh = "mobs_sheep.b3d" self.object:set_properties({textures = {textures}})
}) self.base_texture = {textures}
end end
return return
@ -121,7 +250,7 @@ for _, col in ipairs(all_colours) do
local itemname = item:get_name() local itemname = item:get_name()
local name = clicker:get_player_name() local name = clicker:get_player_name()
--are we giving a haircut> -- are we giving a haircut>
if itemname == "mobs:shears" then if itemname == "mobs:shears" then
if self.gotten ~= false if self.gotten ~= false
@ -132,18 +261,19 @@ for _, col in ipairs(all_colours) do
end end
self.gotten = true -- shaved self.gotten = true -- shaved
self.drops = drops_gotten
local obj = minetest.add_item( local obj = minetest.add_item(
self.object:get_pos(), self.object:get_pos(),
ItemStack( "wool:" .. col[1] .. " " .. math.random(1, 3) ) ItemStack("wool:" .. col[1] .. " " .. random(3))
) )
if obj then if obj then
obj:setvelocity({ obj:set_velocity({
x = math.random(-1, 1), x = random(-1, 1),
y = 5, y = 5,
z = math.random(-1, 1) z = random(-1, 1)
}) })
end end
@ -151,15 +281,15 @@ for _, col in ipairs(all_colours) do
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
self.object:set_properties({ local textures = horn_texture_sel(self.attribute_horns, self.gotten)
textures = {"mobs_sheep_shaved.png"},
mesh = "mobs_sheep_shaved.b3d", self.object:set_properties({textures = {textures}})
}) self.base_texture = {textures}
return return
end end
--are we coloring? -- are we coloring?
if itemname:find("dye:") then if itemname:find("dye:") then
if self.gotten == false if self.gotten == false
@ -171,25 +301,48 @@ for _, col in ipairs(all_colours) do
for _,c in pairs(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() local pos = self.object:get_pos()
self.object:remove() -- add new coloured sheep
local mob = minetest.add_entity(pos, "mobs_animal:sheep_" .. colr) local mob = minetest.add_entity(pos, "mobs_animal:sheep_" .. colr)
local ent = mob:get_luaentity() local ent = mob:get_luaentity()
ent.owner = name if ent then
ent.tamed = true
-- take item -- add old sheep attributes
if not mobs.is_creative(clicker:get_player_name()) then ent.attribute_horns = self.attribute_horns
item:take_item() ent.nametag = self.nametag
clicker:set_wielded_item(item) 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 end
break
end end
end end
end end
@ -205,26 +358,126 @@ for _, col in ipairs(all_colours) do
end 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 -- compatibility
mobs:alias_mob("mobs:sheep_" .. col[1], "mobs_animal:sheep_" .. col[1]) mobs:alias_mob("mobs:sheep_" .. col[1], "mobs_animal:sheep_" .. col[1])
end end
if not mobs.custom_spawn_animal then if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:sheep_white", local max_ht = 400
nodes = {"default:dirt_with_grass", "ethereal:green_dirt"}, local spawn_on = {"default:dirt_with_grass", "ethereal:green_dirt"}
neighbors = {"group:grass"}, local mod_ethereal = minetest.get_modpath("ethereal")
min_light = 14, local spawn_chance = mod_ethereal and 12000 or 8000
interval = 60,
chance = 8000, -- 15000 mobs:spawn({
min_height = 0, name = "mobs_animal:sheep_white",
max_height = 200, nodes = spawn_on,
day_toggle = true 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 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 local S = mobs.intllib_animal
-- Warthog originally by KrupnoPavel, B3D model by sirrobzeroone -- Warthog originally by KrupnoPavel, B3D model by sirrobzeroone
mobs:register_mob("mobs_animal:pumba", { 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 = "mobs:pork_raw", chance = 1, min = 1, max = 3},
{name = "maptools:silver_coin", chance = 10, min = 0, max = 1} {name = "maptools:silver_coin", chance = 10, min = 0, max = 1}
}, },
water_damage = 0, water_damage = 0.01,
lava_damage = 5, lava_damage = 5,
light_damage = 0, light_damage = 0,
fear_height = 2, fear_height = 2,
@ -57,6 +58,7 @@ mobs:register_mob("mobs_animal:pumba", {
die_loop = false, die_loop = false,
die_rotate = true die_rotate = true
}, },
on_rightclick = function(self, clicker) on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then return end if mobs:feed_tame(self, clicker, 8, true, true) then return end
@ -65,6 +67,7 @@ mobs:register_mob("mobs_animal:pumba", {
end end
}) })
local spawn_on = {"default:dirt_with_grass"} local spawn_on = {"default:dirt_with_grass"}
local spawn_by = {"group:grass"} local spawn_by = {"group:grass"}
@ -79,19 +82,22 @@ if minetest.get_modpath("ethereal") then
end end
if not mobs.custom_spawn_animal then if not mobs.custom_spawn_animal then
mobs:spawn({
name = "mobs_animal:pumba", mobs:spawn({
nodes = spawn_on, name = "mobs_animal:pumba",
neighbors = spawn_by, nodes = spawn_on,
min_light = 14, neighbors = spawn_by,
interval = 60, min_light = 14,
chance = 8000, -- 15000 interval = 60,
min_height = 0, chance = 8000,
max_height = 200, min_height = 0,
day_toggle = true max_height = 200,
}) day_toggle = true
})
end end
-- spawn egg
mobs:register_egg("mobs_animal:pumba", S("Warthog"), "mobs_pumba_inv.png") mobs:register_egg("mobs_animal:pumba", S("Warthog"), "mobs_pumba_inv.png")