code tidy

This commit is contained in:
tenplus1 2022-09-27 09:15:59 +01:00
parent 840291ee5b
commit be80ec3269
12 changed files with 260 additions and 208 deletions

57
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"),
@ -104,7 +113,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 +140,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 +156,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.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

@ -19,7 +19,7 @@ stepheight = 0.6,
textures = {
{"mobs_bunny_grey.png"},
{"mobs_bunny_brown.png"},
{"mobs_bunny_white.png"},
{"mobs_bunny_white.png"}
},
sounds = {},
makes_footstep_sound = false,
@ -31,7 +31,7 @@ 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,
lava_damage = 4,
@ -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
@ -69,7 +70,7 @@ stepheight = 0.6,
end
self.object:set_properties({
textures = {"mobs_bunny_evil.png"},
textures = {"mobs_bunny_evil.png"}
})
self.type = "monster"
@ -88,11 +89,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
@ -103,7 +106,7 @@ stepheight = 0.6,
return true -- run only once, false/nil runs every activation
end,
attack_type = "dogfight",
damage = 5,
damage = 5
})
@ -114,17 +117,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 +143,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 +151,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
})

36
cow.lua
View File

@ -70,6 +70,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
@ -100,8 +101,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
@ -112,6 +114,7 @@ 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
ret_item = "mobs:wooden_bucket_milk"
end
@ -120,7 +123,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
@ -144,17 +149,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
@ -170,7 +176,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
@ -178,7 +184,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({

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 @@ 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,19 @@
local S = mobs.intllib_animal
local hairball = minetest.settings:get("mobs_hairball")
-- 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 +27,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,7 +39,7 @@ 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,
lava_damage = 5,
@ -92,7 +93,7 @@ stepheight = 1.1,
self.hairball_timer = 0
if self.child
or math.random(1, 250) > 1 then
or math.random(250) > 1 then
return
end
@ -103,9 +104,9 @@ stepheight = 1.1,
minetest.sound_play("default_dig_snappy", {
pos = pos,
gain = 1.0,
max_hear_distance = 5,
max_hear_distance = 5
})
end,
end
})
@ -116,17 +117,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
@ -164,11 +166,11 @@ minetest.register_craftitem(":mobs:hairball", {
minetest.sound_play("default_place_node_hard", {
pos = newpos,
gain = 1.0,
max_hear_distance = 5,
max_hear_distance = 5
})
itemstack:take_item()
return itemstack
end,
end
})

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

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,7 +36,7 @@ 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,
lava_damage = 5,
@ -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"},
@ -56,20 +57,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")

29
rat.lua
View File

@ -1,6 +1,7 @@
local S = mobs.intllib_animal
-- Rat by PilzAdam (B3D model by sirrobzeroone)
mobs:register_mob("mobs_animal:rat", {
@ -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

@ -88,6 +88,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
@ -100,11 +101,15 @@ for _, col in ipairs(all_colours) do
self.drops = drops_normal
self.object:set_properties({
textures = {"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
textures = {
"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:"
.. col[3] .. ")"
},
mesh = "mobs_sheep.b3d",
})
end
end,
on_rightclick = function(self, clicker)
--are we feeding?
@ -117,7 +122,10 @@ for _, col in ipairs(all_colours) do
self.drops = drops_normal
self.object:set_properties({
textures = {"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:" .. col[3] .. ")"},
textures = {
"mobs_sheep_base.png^(mobs_sheep_wool.png^[colorize:"
.. col[3] .. ")"
},
mesh = "mobs_sheep.b3d"
})
end
@ -144,7 +152,7 @@ for _, col in ipairs(all_colours) do
local obj = minetest.add_item(
self.object:get_pos(),
ItemStack( "wool:" .. col[1] .. " " .. math.random(1, 3) )
ItemStack( "wool:" .. col[1] .. " " .. math.random(3) )
)
if obj then
@ -162,7 +170,7 @@ for _, col in ipairs(all_colours) do
self.object:set_properties({
textures = {"mobs_sheep_shaved.png"},
mesh = "mobs_sheep_shaved.b3d",
mesh = "mobs_sheep_shaved.b3d"
})
return
@ -214,7 +222,9 @@ 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])
@ -223,22 +233,24 @@ 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
})
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,
min_height = 0,
max_height = 200,
day_toggle = true
})
end
mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") -- compatibility
-- raw mutton
minetest.register_craftitem(":mobs:mutton_raw", {
description = S("Raw Mutton"),

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", {
@ -56,6 +57,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
@ -64,6 +66,7 @@ mobs:register_mob("mobs_animal:pumba", {
end
})
local spawn_on = {"default:dirt_with_grass"}
local spawn_by = {"group:grass"}
@ -78,19 +81,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")