Compare commits

25 Commits

Author SHA1 Message Date
766f6ff754 Merge remote-tracking branch 'upstream/master' 2025-03-20 12:25:20 +01:00
8480571665 add ukrainian translation (thx Fromkaniv) 2025-03-15 16:41:11 +00:00
1d9674721f make eat grass block false by default 2025-02-06 08:59:22 +00:00
8d5fb34534 add mobs_animal.eat_grass_block setting 2025-02-05 07:58:27 +00:00
b8dade7498 add pick_up and on_pick_up example to cow.lua 2025-02-04 10:21:42 +00:00
810239fadc tweak cow die animation 2025-01-19 08:16:02 +00:00
3792d1cf3c change armor levels to 100 2025-01-01 11:04:09 +00:00
d76893ccb8 update russian translation (thx skybuilder1717) 2024-11-04 17:21:19 +00:00
1640a32619 add white rat, replace sounds 2024-11-04 13:34:05 +00:00
e4f16e4911 add 16px cheeseblock texture 2024-09-20 17:44:14 +01:00
39f4ffa2d9 Merge remote-tracking branch 'upstream/master' 2024-09-15 09:25:21 +02:00
fa3e48166d better butter 2024-08-31 12:07:32 +01:00
53f72b8a9e tweak and tidy code 2024-08-10 14:10:22 +01:00
10865e9ab4 fix default check 2024-08-09 07:59:02 +01:00
a240d0c937 add esperanto translation (thx jadedctrl) 2024-08-02 09:46:55 +01:00
01f4922892 use helper function for {eatable} 2024-07-26 17:10:17 +01:00
9cd2974533 add {eatable} group to food items and update infotext 2024-07-26 14:49:21 +01:00
3260afbad4 fix nametag bug when colouring sheep 2024-07-22 14:57:55 +01:00
823a1dc0b2 update license 2024-04-23 08:03:53 +01:00
dc43a7505c fix baby sheep horn issue, update licenses 2024-04-22 07:56:54 +01:00
808bbf82e9 fix missing horns on respawn/egg place 2024-03-16 07:28:44 +00:00
76c30c81c3 set is_ground_content for honey block, chicken egg and beehive (thx SwissAlpS) 2024-02-27 07:58:50 +00:00
bf12043fdc have chance of chicken dropping a feather 2023-12-16 08:32:32 +00:00
4ada017824 Merge remote-tracking branch 'upstream/master' 2023-12-13 21:00:34 +01:00
7b76829046 use api functions for kitten 2023-10-13 08:30:57 +01:00
26 changed files with 496 additions and 408 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

79
bee.lua
View File

@ -1,4 +1,4 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Bee by KrupnoPavel (.b3d model by sirrobzeroone)
@ -8,19 +8,15 @@ mobs:register_mob("mobs_animal:bee", {
passive = true,
hp_min = 1,
hp_max = 2,
armor = 200,
armor = 100,
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.5, 0.2},
visual = "mesh",
mesh = "mobs_bee.b3d",
textures = {
{"mobs_bee.png"}
},
textures = { {"mobs_bee.png"} },
blood_texture = "mobs_bee_inv.png",
blood_amount = 1,
makes_footstep_sound = false,
sounds = {
random = "mobs_bee"
},
sounds = { random = "mobs_bee" },
walk_velocity = 1,
jump = true,
drops = {
@ -33,10 +29,8 @@ mobs:register_mob("mobs_animal:bee", {
fall_speed = -3,
animation = {
speed_normal = 15,
stand_start = 0,
stand_end = 30,
walk_start = 35,
walk_end = 65
stand_start = 0, stand_end = 30,
walk_start = 35, walk_end = 65
},
on_rightclick = function(self, clicker)
@ -48,6 +42,8 @@ mobs:register_mob("mobs_animal:bee", {
-- end,
})
-- where to spawn
if not mobs.custom_spawn_animal then
mobs:spawn({
@ -62,25 +58,27 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:bee", S("Bee"), "mobs_bee_inv.png")
-- 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}
})
mobs.add_eatable("mobs:honey", 4)
-- beehive (1 in 4 chance of spawning bee when placed)
-- beehive (when placed spawns bee)
minetest.register_node(":mobs:beehive", {
description = S("Beehive"),
drawtype = "plantlike",
@ -90,7 +88,8 @@ minetest.register_node(":mobs:beehive", {
sunlight_propagates = true,
walkable = true,
groups = {oddly_breakable_by_hand = 3, flammable = 1, disable_suffocation = 1},
sounds = default and default.node_sound_defaults(),
is_ground_content = false,
sounds = mobs.node_sound_defaults(),
on_construct = function(pos)
@ -126,47 +125,42 @@ minetest.register_node(":mobs:beehive", {
local hp = puncher and puncher:get_hp()
if hp then
puncher:set_hp(hp - 4)
end
if hp then puncher:set_hp(hp - 4) end
end)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if listname == "beehive" then
return 0
end
if listname == "beehive" then return 0 end
return stack:get_count()
end,
can_dig = function(pos,player)
can_dig = function(pos,player) -- can only dig when no honey inside
local meta = minetest.get_meta(pos)
-- only dig beehive if no honey inside
return meta:get_inventory():is_empty("beehive")
end
})
-- beehive recipe
minetest.register_craft({
output = "mobs:beehive",
recipe = {
{"mobs:bee","mobs:bee","mobs:bee"}
}
recipe = {{"mobs:bee","mobs:bee","mobs:bee"}}
})
-- honey block
-- honey block and craft recipes
minetest.register_node(":mobs:honey_block", {
description = S("Honey Block"),
tiles = {"mobs_honey_block.png"},
groups = {snappy = 3, flammable = 2},
sounds = default and default.node_sound_dirt_defaults()
is_ground_content = false,
sounds = mobs.node_sound_dirt_defaults()
})
-- recipe
minetest.register_craft({
output = "mobs:honey_block",
recipe = {
@ -183,38 +177,31 @@ minetest.register_craft({
}
})
-- beehive workings
minetest.register_abm({
nodenames = {"mobs:beehive"},
interval = 12,
chance = 6,
catch_up = false,
action = function(pos, node)
-- bee's only make honey during the day
local tod = (minetest.get_timeofday() or 0) * 24000
if tod < 5500 or tod > 18500 then
return
end
if tod < 5500 or tod > 18500 then return end
-- is hive full?
local meta = minetest.get_meta(pos)
if not meta then return end -- for older beehives
local meta = minetest.get_meta(pos) ; if not meta then return end
local inv = meta:get_inventory()
local honey = inv:get_stack("beehive", 1):get_count()
-- is hive full?
if honey > 11 then
return
end
if honey > 11 then return end -- return if hive full
-- no flowers no honey, nuff said!
if #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},
"group:flower") > 3 then
{x = pos.x - 4, y = pos.y - 3, z = pos.z - 4},
{x = pos.x + 4, y = pos.y + 3, z = pos.z + 4}, "group:flower") > 3 then
inv:add_item("beehive", "mobs:honey")
end

View File

@ -1,4 +1,4 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Bunny by ExeterDad
@ -10,7 +10,7 @@ mobs:register_mob("mobs_animal:bunny", {
stepheight = 0.6,
hp_min = 1,
hp_max = 4,
armor = 200,
armor = 100,
collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268},
visual = "mesh",
mesh = "mobs_bunny.b3d",
@ -38,12 +38,9 @@ mobs:register_mob("mobs_animal:bunny", {
fear_height = 2,
animation = {
speed_normal = 15,
stand_start = 1,
stand_end = 15,
walk_start = 16,
walk_end = 24,
punch_start = 16,
punch_end = 24
stand_start = 1, stand_end = 15,
walk_start = 16, walk_end = 24,
punch_start = 16, punch_end = 24
},
follow = {"farming:carrot", "farming_plus:carrot_item", "default:grass_1"},
view_range = 8,
@ -93,9 +90,7 @@ mobs:register_mob("mobs_animal:bunny", {
obj:set_properties({textures = {"mobs_bunny_evil.png"}, hp_max = 20})
-- remove old bunny
if obj:get_luaentity() then
mobs:remove(self, true)
end
if obj:get_luaentity() then mobs:remove(self, true) end
end
end,
@ -126,15 +121,16 @@ mobs:register_mob("mobs_animal:bunny", {
end
})
local spawn_on = "default:dirt_with_grass"
if minetest.get_modpath("ethereal") then
spawn_on = "ethereal:prairie_dirt"
end
-- where to spawn
if not mobs.custom_spawn_animal then
local spawn_on = "default:dirt_with_grass"
if minetest.get_modpath("ethereal") then
spawn_on = "ethereal:prairie_dirt"
end
mobs:spawn({
name = "mobs_animal:bunny",
nodes = {spawn_on},
@ -148,29 +144,36 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:bunny", S("Bunny"), "mobs_bunny_inv.png", 0)
-- compatibility (only used for older mobs compatibility)
mobs:alias_mob("mobs:bunny", "mobs_animal:bunny") -- compatibility
mobs:alias_mob("mobs:bunny", "mobs_animal:bunny")
-- raw rabbit
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}
})
mobs.add_eatable("mobs:rabbit_raw", 3)
-- cooked rabbit
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}
})
mobs.add_eatable("mobs:rabbit_cooked", 5)
minetest.register_craft({
type = "cooking",
output = "mobs:rabbit_cooked",
@ -178,18 +181,15 @@ minetest.register_craft({
cooktime = 5
})
-- rabbit hide
-- rabbit hide and recipes
minetest.register_craftitem(":mobs:rabbit_hide", {
description = S("Rabbit Hide"),
inventory_image = "mobs_rabbit_hide.png",
groups = {flammable = 2, pelt = 1}
})
minetest.register_craft({
type = "fuel",
recipe = "mobs:rabbit_hide",
burntime = 2
})
minetest.register_craft({type = "fuel", recipe = "mobs:rabbit_hide", burntime = 2})
minetest.register_craft({
output = "mobs:leather",

View File

@ -1,4 +1,4 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Chicken by JK Murray and Sirrobzeroone
@ -9,7 +9,7 @@ mobs:register_mob("mobs_animal:chicken", {
passive = true,
hp_min = 5,
hp_max = 10,
armor = 200,
armor = 100,
collisionbox = {-0.3, -0.75, -0.3, 0.3, 0.1, 0.3},
visual = "mesh",
mesh = "mobs_chicken.b3d",
@ -18,12 +18,11 @@ mobs:register_mob("mobs_animal:chicken", {
{"mobs_chicken_brown.png"},
{"mobs_chicken_black.png"}
},
child_texture = {
{"mobs_chick.png"}
},
child_texture = {{"mobs_chick.png"}},
makes_footstep_sound = true,
sounds = {
random = "mobs_chicken"
random = "mobs_chicken",
replace = "default_dig_crumbly"
},
walk_velocity = 1,
run_velocity = 3,
@ -41,18 +40,10 @@ mobs:register_mob("mobs_animal:chicken", {
fear_height = 5,
animation = {
speed_normal = 15,
stand_start = 1,
stand_end = 30,
stand_speed = 28,
stand1_start = 31,
stand1_end = 70,
stand1_speed = 32,
walk_start = 71,
walk_end = 90,
walk_speed = 24,
run_start = 91,
run_end = 110,
run_speed = 24
stand_start = 1, stand_end = 30, stand_speed = 28,
stand1_start = 31, stand1_end = 70, stand1_speed = 32,
walk_start = 71, walk_end = 90, walk_speed = 24,
run_start = 91, run_end = 110, run_speed = 24
},
follow = {
"farming:seed_wheat", "farming:seed_cotton", "farming:seed_barley",
@ -84,38 +75,36 @@ mobs:register_mob("mobs_animal:chicken", {
do_custom = function(self, dtime)
self.egg_timer = (self.egg_timer or 0) + dtime
if self.egg_timer < 10 then
return
end
if self.egg_timer < 10 then return end
self.egg_timer = 0
if self.child
or math.random(100) > 1 then
return
end
if self.child then return end
local pos = self.object:get_pos() ; if not pos then return end
minetest.add_item(pos, "mobs:egg")
if math.random(100) == 1 then
minetest.sound_play("default_place_node_hard", {
pos = pos,
gain = 1.0,
max_hear_distance = 5
}, true)
minetest.add_item(pos, "mobs:egg")
minetest.sound_play("default_place_node_hard",
{pos = pos, gain = 1.0, max_hear_distance = 5}, true)
elseif math.random(100) < 3 then
minetest.add_item(pos, "mobs:chicken_feather")
end
end
})
local spawn_on = {"default:dirt_with_grass"}
if minetest.get_modpath("ethereal") then
spawn_on = {"ethereal:bamboo_dirt", "ethereal:prairie_dirt"}
end
-- where to spawn
if not mobs.custom_spawn_animal then
local spawn_on = {"default:dirt_with_grass"}
if minetest.get_modpath("ethereal") then
spawn_on = {"ethereal:bamboo_dirt", "ethereal:prairie_dirt"}
end
mobs:spawn({
name = "mobs_animal:chicken",
nodes = spawn_on,
@ -129,22 +118,24 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:chicken", S("Chicken"), "mobs_chicken_inv.png", 0)
-- compatibility with older mobs mod
mobs:alias_mob("mobs:chicken", "mobs_animal:chicken") -- compatibility
mobs:alias_mob("mobs:chicken", "mobs_animal:chicken")
-- egg entity
mobs:register_arrow("mobs_animal:egg_entity", {
visual = "sprite",
visual_size = {x=.5, y=.5},
visual_size = {x = .5, y = .5},
textures = {"mobs_chicken_egg.png"},
velocity = 6,
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}
@ -152,6 +143,7 @@ mobs:register_arrow("mobs_animal:egg_entity", {
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 1}
@ -160,16 +152,13 @@ mobs:register_arrow("mobs_animal:egg_entity", {
hit_node = function(self, pos, node)
if math.random(10) > 1 then
return
end
if math.random(10) > 1 then return end
pos.y = pos.y + 1
local nod = minetest.get_node_or_nil(pos)
if not nod
or not minetest.registered_nodes[nod.name]
if not nod or not minetest.registered_nodes[nod.name]
or minetest.registered_nodes[nod.name].walkable == true then
return
end
@ -184,22 +173,17 @@ mobs:register_arrow("mobs_animal:egg_entity", {
end
})
-- egg throwing item
-- egg throwing function
local egg_GRAVITY = 9
local egg_VELOCITY = 19
-- shoot egg
local mobs_shoot_egg = function (item, player, pointed_thing)
local playerpos = player:get_pos()
minetest.sound_play("default_place_node_hard", {
pos = playerpos,
gain = 1.0,
max_hear_distance = 5
})
minetest.sound_play("default_place_node_hard",
{pos = playerpos, gain = 1.0, max_hear_distance = 5}, true)
local obj = minetest.add_entity({
x = playerpos.x,
@ -215,16 +199,10 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
ent._is_arrow = true -- tell advanced mob protection this is an arrow
obj:set_velocity({
x = dir.x * egg_VELOCITY,
y = dir.y * egg_VELOCITY,
z = dir.z * egg_VELOCITY
})
x = dir.x * egg_VELOCITY, y = dir.y * egg_VELOCITY, z = dir.z * egg_VELOCITY})
obj:set_acceleration({
x = dir.x * -3,
y = -egg_GRAVITY,
z = dir.z * -3
})
x = dir.x * -3, y = -egg_GRAVITY, z = dir.z * -3})
-- pass player name to egg for chick ownership
local ent2 = obj:get_luaentity()
@ -236,8 +214,8 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
return item
end
-- egg
minetest.register_node(":mobs:egg", {
description = S("Chicken Egg"),
tiles = {"mobs_chicken_egg.png"},
@ -247,30 +225,33 @@ minetest.register_node(":mobs:egg", {
wield_image = "mobs_chicken_egg.png",
paramtype = "light",
walkable = false,
is_ground_content = true,
is_ground_content = false,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0, 0.2}
},
groups = {food_egg = 1, snappy = 2, dig_immediate = 3},
sounds = mobs.node_sound_defaults(),
after_place_node = function(pos, placer, itemstack)
if placer:is_player() then
minetest.set_node(pos, {name = "mobs:egg", param2 = 1})
end
minetest.set_node(pos, {name = "mobs:egg", param2 = 1})
end,
on_use = mobs_shoot_egg
})
-- fried egg and recipe
-- fried egg
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}
})
mobs.add_eatable("mobs:chicken_egg_fried", 2)
minetest.register_craft({
type = "cooking",
recipe = "mobs:egg",
@ -278,36 +259,39 @@ minetest.register_craft({
})
-- raw chicken
minetest.register_craftitem(":mobs:chicken_raw", {
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}
})
-- cooked chicken
mobs.add_eatable("mobs:chicken_raw", 2)
-- cooked chicken and recipe
minetest.register_craftitem(":mobs:chicken_cooked", {
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}
})
mobs.add_eatable("mobs:chicken_cooked", 6)
minetest.register_craft({
type = "cooking",
recipe = "mobs:chicken_raw",
output = "mobs:chicken_cooked"
})
-- feather
-- feather and fuel
minetest.register_craftitem(":mobs:chicken_feather", {
description = S("Feather"),
inventory_image = "mobs_chicken_feather.png",
groups = {flammable = 2, feather = 1}
})
minetest.register_craft({
type = "fuel",
recipe = "mobs:chicken_feather",
burntime = 1
})
minetest.register_craft({type = "fuel", recipe = "mobs:chicken_feather", burntime = 1})

109
cow.lua
View File

@ -1,6 +1,15 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- should cows eat grass blocks and mess up the environment?
local eat_gb = minetest.settings:get_bool("mobs_animal.eat_grass_block")
local replace_what = { {"group:grass", "mobs:dung", 0} }
if eat_gb then
table.insert(replace_what, {"default:dirt_with_grass", "default:dirt", -1})
end
-- Cow by sirrobzeroone
mobs:register_mob("mobs_animal:cow", {
@ -10,9 +19,9 @@ mobs:register_mob("mobs_animal:cow", {
attack_npcs = false,
reach = 2,
damage = 4,
hp_min = 5,
hp_min = 10,
hp_max = 20,
armor = 200,
armor = 100,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.2, 0.4},
visual = "mesh",
mesh = "mobs_cow.b3d",
@ -23,6 +32,7 @@ mobs:register_mob("mobs_animal:cow", {
makes_footstep_sound = true,
sounds = {
random = "mobs_cow",
replace = "default_dig_crumbly"
},
walk_velocity = 1,
run_velocity = 2,
@ -38,25 +48,12 @@ mobs:register_mob("mobs_animal:cow", {
lava_damage = 5,
light_damage = 0,
animation = {
stand_start = 0,
stand_end = 30,
stand_speed = 20,
stand1_start = 35,
stand1_end = 75,
stand1_speed = 20,
walk_start = 85,
walk_end = 114,
walk_speed = 20,
run_start = 120,
run_end = 140,
run_speed = 30,
punch_start = 145,
punch_end = 160,
punch_speed = 20,
die_start = 165,
die_end = 185,
die_speed = 10,
die_loop = false
stand_start = 0, stand_end = 30, stand_speed = 20,
stand1_start = 35, stand1_end = 75, stand1_speed = 20,
walk_start = 85, walk_end = 114, walk_speed = 20,
run_start = 120, run_end = 140, run_speed = 30,
punch_start = 145, punch_end = 160, punch_speed = 20,
die_start = 165, die_end = 185, die_speed = 25, die_loop = false
},
follow = {
"farming:wheat", "default:grass_1", "farming:barley",
@ -64,10 +61,20 @@ mobs:register_mob("mobs_animal:cow", {
},
view_range = 8,
replace_rate = 10,
replace_what = {
{"group:grass", "mobs:dung", 0},
{"default:dirt_with_grass", "default:dirt", -1}
},
replace_what = replace_what,
--[[
pick_up = {"default:grass_1", "default:dry_grass_1"},
on_pick_up = function(self, entity)
local istack = ItemStack(entity.itemstring)
print("-- took", istack:get_name())
istack:take_item(1)
return istack
end,
]]
-- stay_near = {{"farming:straw", "group:grass"}, 10},
fear_height = 2,
@ -77,9 +84,7 @@ mobs:register_mob("mobs_animal:cow", {
if mobs:feed_tame(self, clicker, 8, true, true) then
-- if fed 7x wheat or grass then cow can be milked again
if self.food and self.food > 6 then
self.gotten = false
end
if self.food and self.food > 6 then self.gotten = false end
return
end
@ -96,10 +101,7 @@ mobs:register_mob("mobs_animal:cow", {
or item == "wooden_bucket:bucket_wood_empty"
or item == "bucket_wooden:bucket_empty" then
--if self.gotten == true
if self.child == true then
return
end
if self.child == true then return end
if self.gotten == true then
@ -141,14 +143,14 @@ mobs:register_mob("mobs_animal:cow", {
self.food = (self.food or 0) + 1
-- if cow replaces 8x grass then it can be milked again
if self.food >= 8 then
if self.food >= 8 then -- replace 8x grass and can be milked again
self.food = 0
self.gotten = false
end
end
})
-- where to spawn
if not mobs.custom_spawn_animal then
@ -165,30 +167,36 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:cow", S("Cow"), "mobs_cow_inv.png")
-- old mobs mod compatibility
mobs:alias_mob("mobs:cow", "mobs_animal:cow") -- compatibility
mobs:alias_mob("mobs:cow", "mobs_animal:cow")
-- bucket of milk
minetest.register_craftitem(":mobs:bucket_milk", {
description = S("Bucket of 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, drink = 1}
})
-- glass of milk
mobs.add_eatable("mobs:bucket_milk", 8)
-- glass of milk and recipes
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, vessel = 1, drink = 1}
})
mobs.add_eatable("mobs:glass_milk", 2)
minetest.register_craft({
output = "mobs:glass_milk 4",
recipe = {
@ -211,15 +219,17 @@ minetest.register_craft({
}
})
-- butter and recipe
-- butter
minetest.register_craftitem(":mobs:butter", {
description = S("Butter"),
inventory_image = "mobs_butter.png",
on_use = minetest.item_eat(1),
groups = {food_butter = 1, flammable = 2}
groups = {food_butter = 1}
})
mobs.add_eatable("mobs:butter", 1)
local salt_item = "default:sapling" -- some saplings are high in sodium
if minetest.get_modpath("farming") and farming and farming.mod then
@ -232,14 +242,17 @@ minetest.register_craft({
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- cheese wedge
-- cheese wedge and recipe
minetest.register_craftitem(":mobs:cheese", {
description = S("Cheese"),
inventory_image = "mobs_cheese.png",
on_use = minetest.item_eat(4),
groups = {food_cheese = 1, flammable = 2}
groups = {food_cheese = 1}
})
mobs.add_eatable("mobs:cheese", 4)
minetest.register_craft({
type = "cooking",
output = "mobs:cheese",
@ -248,13 +261,14 @@ minetest.register_craft({
replacements = {{"mobs:bucket_milk", "bucket:bucket_empty"}}
})
-- cheese block
-- cheese block and recipe
minetest.register_node(":mobs:cheeseblock", {
description = S("Cheese Block"),
tiles = {"mobs_cheeseblock.png"},
is_ground_content = false,
groups = {oddly_breakable_by_hand = 3},
sounds = default and default.node_sound_dirt_defaults()
sounds = mobs.node_sound_dirt_defaults()
})
minetest.register_craft({
@ -271,7 +285,7 @@ minetest.register_craft({
recipe = {{"mobs:cheeseblock"}}
})
-- Dung (from factory's fertilizer)
-- NALC: Dung (from factory's fertilizer)
minetest.register_node(
":mobs:dung",
{
@ -301,6 +315,7 @@ minetest.register_craft({
})
-- 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")

View File

@ -1,9 +1,11 @@
-- translation and mod path
local S = minetest.get_translator("mobs_animal")
local path = minetest.get_modpath(minetest.get_current_modname()) .. "/"
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Check for custom mob spawn file
local input = io.open(path .. "spawn.lua", "r")
if input then
@ -12,8 +14,8 @@ if input then
input = nil
end
-- helper function
local function ddoo(mob)
if minetest.settings:get_bool("mobs_animal." .. mob) == false then
@ -25,6 +27,7 @@ local function ddoo(mob)
end
-- Animals
ddoo("chicken") -- JKmurray
ddoo("cow") -- KrupnoPavel
ddoo("rat") -- PilzAdam
@ -37,16 +40,16 @@ ddoo("penguin") -- D00Med
ddoo("panda") -- AspireMint
dofile(path .. "goat.lua") -- NALC(sys4 fork MFF)
-- Load custom spawning if found
-- Load custom spawning
if mobs.custom_spawn_animal then
dofile(path .. "spawn.lua")
end
-- Lucky Blocks
if minetest.get_modpath("lucky_block") then
dofile(path .. "lucky_block.lua")
end
print ("[MOD] Mobs Animal loaded")
print ("[MOD] Mobs Redo Animals loaded")

View File

@ -1,7 +1,10 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
local hairball = minetest.settings:get("mobs_hairball")
-- translation and hairball setting
local S = minetest.get_translator("mobs_animal")
local hairball = minetest.settings:get_bool("mobs_animal.hairball") ~= false
-- custom kitty types
local kitten_types = {
@ -25,7 +28,7 @@ mobs:register_mob("mobs_animal:kitten", {
passive = false,
hp_min = 5,
hp_max = 10,
armor = 200,
armor = 100,
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3},
visual = "mesh",
visual_size = {x = 0.5, y = 0.5},
@ -37,9 +40,7 @@ mobs:register_mob("mobs_animal:kitten", {
{"mobs_kitten_sandy.png"}
},
makes_footstep_sound = false,
sounds = {
random = "mobs_kitten"
},
sounds = {random = "mobs_kitten"},
walk_velocity = 0.6,
walk_chance = 15,
run_velocity = 2,
@ -53,12 +54,9 @@ mobs:register_mob("mobs_animal:kitten", {
fear_height = 3,
animation = {
speed_normal = 42,
stand_start = 97,
stand_end = 192,
walk_start = 0,
walk_end = 96,
stoodup_start = 0,
stoodup_end = 0,
stand_start = 97, stand_end = 192,
walk_start = 0, walk_end = 96,
stoodup_start = 0, stoodup_end = 0,
},
follow = {
"mobs_animal:rat", "group:food_fish_raw",
@ -102,29 +100,23 @@ mobs:register_mob("mobs_animal:kitten", {
self.order = "stand"
self.state = "stand"
self.object:set_velocity({x = 0, y = 0, z = 0})
mobs:set_animation(self, "stand")
self:set_animation("stand")
else
self.order = ""
mobs:set_animation(self, "stoodup")
self:set_animation("stoodup")
end
end
end,
do_custom = function(self, dtime)
if hairball == "false" then
return
end
if not hairball then return end
self.hairball_timer = (self.hairball_timer or 0) + dtime
if self.hairball_timer < 10 then
return
end
if self.hairball_timer < 10 then return end
self.hairball_timer = 0
if self.child or math.random(250) > 1 then
return
end
if self.child or math.random(250) > 1 then return end
local pos = self.object:get_pos()
@ -135,15 +127,16 @@ mobs:register_mob("mobs_animal:kitten", {
end
})
local spawn_on = "default:dirt_with_grass"
if minetest.get_modpath("ethereal") then
spawn_on = "ethereal:grove_dirt"
end
-- where to spawn
if not mobs.custom_spawn_animal then
local spawn_on = "default:dirt_with_grass"
if minetest.get_modpath("ethereal") then
spawn_on = "ethereal:grove_dirt"
end
mobs:spawn({
name = "mobs_animal:kitten",
nodes = {spawn_on},
@ -157,12 +150,15 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:kitten", S("Kitten"), "mobs_kitten_inv.png", 0)
-- compatibility with old mobs mod
mobs:alias_mob("mobs:kitten", "mobs_animal:kitten") -- compatibility
mobs:alias_mob("mobs:kitten", "mobs_animal:kitten")
-- hairball and items
local hairball_items = {
"default:stick", "default:coal_lump", "default:dry_shrub", "flowers:rose",
@ -178,6 +174,7 @@ local hairball_items = {
minetest.register_craftitem(":mobs:hairball", {
description = S("Hairball"),
inventory_image = "mobs_hairball.png",
on_use = function(itemstack, user, pointed_thing)
local pos = user:get_pos()
@ -185,8 +182,7 @@ minetest.register_craftitem(":mobs:hairball", {
local newpos = {x = pos.x + dir.x, y = pos.y + dir.y + 1.5, z = pos.z + dir.z}
local item = hairball_items[math.random(1, #hairball_items)]
if item ~= ""
and minetest.registered_items[item] then
if item ~= "" and minetest.registered_items[item] then
minetest.add_item(newpos, {name = item})
end

View File

@ -24,6 +24,7 @@ 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.
Honey block, cheese and Cheese block by TenPlus1 under CC0
Chicken/Cow/Panda/Pig/Sheep sounds from freesounds.org under CC0
@ -49,7 +50,6 @@ Models/Textures/Media by Krupnov Pavel (WTFPL)
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
@ -67,6 +67,7 @@ Models/Textures by JK Murray (CC0)
mobs_chick.png
Models/Textures by sirrobzerrone (CC0)
mobs_bee.png
mobs_cow.b3d
mobs_cow.png
mobs_cow2.png

50
locale/mobs_animal.eo.tr Normal file
View File

@ -0,0 +1,50 @@
# textdomain: mobs_animal
Bee=Abelo
Honey=Mielo
Beehive=Abelujo
Honey Block=Miela bloko
Bunny=Kuniklo
Raw Rabbit=Kruda kuniklaĵo
Cooked Rabbit=Kuirita kuniklaĵo
Rabbit Hide=Kuniklofelo
Chicken=Koko
Chicken Egg=Koka ovo
Fried Egg=Kuirita ovo
Raw Chicken=Kruda kokaĵo
Cooked Chicken=Kuirita koko
Feather=Plumo
Cow already milked!=Bovo jam melkita!
Cow=Bovo
Bucket of Milk=Sitelo da lakto
Glass of Milk=Glaso da lakto
Butter=Butero
Cheese=Fromaĝo
Cheese Block=Fromaĝa bloko
Wooden Bucket of Milk=Ligna sitelo da lakto
Kitten=Katido
Hairball=Haraĵo
Panda=Ĉina urso
Penguin=Pingveno
Rat=Rato
Cooked Rat=Kuirita rataĵo
Black=Nigra
Blue=Blua
Brown=Bruna
Cyan=Bluverda
Dark Green=Malhela verda
Dark Grey=Malhela griza
Green=Verda
Grey=Griza
Magenta=Fuksina
Orange=Oranĝa
Pink=Rozkolora
Red=Ruĝa
Violet=Violkolora
White=Blanka
Yellow=Flava
@1 Sheep=@1 ŝafo
Raw Mutton=Kruda ŝafaĵo
Cooked Mutton=Kuirita ŝafaĵo
Warthog=Verukapro
Raw Porkchop=Kruda porkaĵo
Cooked Porkchop=Kuirita porkaĵo

View File

@ -1,4 +1,4 @@
# textdomain: Lunovox Heavenfinder (https://libreplanet.org/wiki/User:Lunovox) <lunovox@disroot.org>
# textdomain:mobs_animal
Bee=Abelha
Honey=Mel
Beehive=Colméia

View File

@ -1,4 +1,4 @@
# textdomain: Lunovox Heavenfinder (https://libreplanet.org/wiki/User:Lunovox) <lunovox@disroot.org>
# textdomain:mobs_animal
Bee=Abelha
Honey=Mel
Beehive=Colméia

View File

@ -1,50 +1,49 @@
# textdomain:mobs_animal
@1 Sheep=@1 овца
@1 Sheep=@1 Овца
Bee=Пчела
Beehive=Улей
Beehive=Пчелиный Улей
Black=Черная
Blue=Синяя
Brown=Коричневая
Bucket of Milk=Ведро молока
Bucket of Milk=Ведро Молока
Bunny=Кролик
Butter=Масло
Cheese=Сыр
Cheese Block=Блок сыра
Cheese Block=Блок Сыра
Chicken=Курица
Chicken Egg=Куриное яйцо
Cooked Chicken=Приготовленная курятина
Cooked Mutton=Приготовленная баранина
Cooked Porkchop=Приготовленные свиные отбивные
Cooked Rabbit=Приготовленная крольчатина
Cooked Rat=Приготовленная крыса
Chicken Egg=Куриное Яйцо
Cooked Chicken=Приготовленная Курятина
Cooked Mutton=Приготовленная Баранина
Cooked Porkchop=Приготовленные Отбивные
Cooked Rabbit=Приготовленная Крольчатина
Cooked Rat=Приготовленная Крыса
Cow=Корова
Cow already milked!=Корову уже подоили!
Cow already milked!=Корова уже подоена!
Cyan=Голубая
Dark Green=Темно-зеленая
Dark Grey=Темно-серая
Feather=Перо
Fried Egg=Яичница
Glass of Milk=Стакан молока
Glass of Milk=Стакан Молока
Green=Зеленая
Grey=Серая
Hairball=Комочек шерсти
Honey=Мёд
Honey Block=Блок мёда
Honey Block=Блок Мёда
Kitten=Котенок
Magenta=Пурпурная
Orange=Оранжевая
Panda=Панда
Penguin=Пингвин
Pink=Розовая
Rabbit Hide=Кроличья шкурка
Rabbit Hide=Кроличья Шкурка
Rat=Крыса
Raw Chicken=Сырая курятина
Raw Mutton=Сырая баранина
Raw Porkchop=Свиные отбивные
Raw Rabbit=Сырая крольчатина
Raw Chicken=Сырая Курятина
Raw Mutton=Сырая Баранина
Raw Porkchop=Свиные Отбивные
Raw Rabbit=Сырая Крольчатина
Red=Красная
Violet=Фиолетовая
Warthog=Бородавочник
White=Белая
Yellow=Желтая
#[MOD] Mobs Redo Animals loaded=
Yellow=Желтая

52
locale/mobs_animal.uk.tr Normal file
View File

@ -0,0 +1,52 @@
# textdomain:mobs_animal
Mobs Animal=Моби Тварини
Add farm animals and a few extra into your world.=Додає свійських тварин і трохи додаткового контенту у світ.
Adds farm animals.=Додає свійських тварин.
@1 Sheep=@1 вівця
Bee=Бджола
Beehive=Бджолиний вулик
Black=Чорна
Blue=Синя
Brown=Коричнева
Bucket of Milk=Відро молока
Bunny=Кролик
Butter=Масло
Cheese=Твердий сир
Cheese Block=Блок твердого сиру
Chicken=Курка
Chicken Egg=Яйце курки
Cooked Chicken=Приготовлена ​​курятина
Cooked Mutton=Приготовлена ​​баранина
Cooked Porkchop=Приготовлені відбивні
Cooked Rabbit=Приготовлена ​​крольчатина
Cooked Rat=Приготовлений пацюк
Cow=Корова
Cow already milked!=Корова вже подоєна!
Cyan=Блакитна
Dark Green=Темно-зелена
Dark Grey=Темно-сіра
Feather=Перо
Fried Egg=Яєшня
Glass of Milk=Склянка молока
Green=Зелена
Grey=Сіра
Hairball=Купка шерсті
Honey=Мед
Honey Block=Блок меду
Kitten=Кошеня
Magenta=Пурпурна
Orange=Помаранчева
Panda=Панда
Penguin=Пінгвін
Pink=Рожева
Rabbit Hide=Кроляча шкірка
Rat=Пацюк
Raw Chicken=Сира курятина
Raw Mutton=Сира баранина
Raw Porkchop=Свинячі відбивні
Raw Rabbit=Сира крольчатина
Red=Червона
Violet=Фіолетова
Warthog=Бородавочник
White=Біла
Yellow=Жовта

View File

@ -1,3 +1,6 @@
-- add lucky blocks
lucky_block:add_blocks({
{"spw", "mobs:sheep", 5},
{"spw", "mobs:rat", 5},
@ -20,6 +23,8 @@ lucky_block:add_blocks({
{"dro", {"mobs:glass_milk"}, 5}
})
-- if nyancat found add special block
if minetest.registered_nodes["default:nyancat"] then
lucky_block:add_blocks({

View File

@ -1,10 +1,10 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Panda by AspireMint (CC BY-SA 3.0)
mobs:register_mob("mobs_animal:panda", {
stepheight = 0.6,
stepheight = 0.6,
type = "animal",
passive = false,
attack_type = "dogfight",
@ -15,13 +15,11 @@ stepheight = 0.6,
damage = 3,
hp_min = 10,
hp_max = 24,
armor = 200,
armor = 100,
collisionbox = {-0.4, -0.45, -0.4, 0.4, 0.45, 0.4},
visual = "mesh",
mesh = "mobs_panda.b3d",
textures = {
{"mobs_panda.png"}
},
textures = {{"mobs_panda.png"}},
makes_footstep_sound = true,
sounds = {
random = "mobs_panda",
@ -43,21 +41,13 @@ stepheight = 0.6,
fear_height = 6,
animation = {
speed_normal = 15,
stand_start = 130,
stand_end = 270,
stand1_start = 0,
stand1_end = 0,
stand2_start = 1,
stand2_end = 1,
stand3_start = 2,
stand3_end = 2,
walk_start = 10,
walk_end = 70,
run_start = 10,
run_end = 70,
punch_start = 80,
punch_end = 120,
-- 0 = rest, 1 = hiding (covers eyes), 2 = surprised
stand_start = 130, stand_end = 270,
stand1_start = 0, stand1_end = 0, -- rest
stand2_start = 1, stand2_end = 1, -- covers eyes
stand3_start = 2, stand3_end = 2, -- surprised
walk_start = 10, walk_end = 70,
run_start = 10, run_end = 70,
punch_start = 80, punch_end = 120
},
on_rightclick = function(self, clicker)
@ -68,6 +58,7 @@ stepheight = 0.6,
end
})
-- where to spawn (ethereal bamboo biome only)
if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
@ -84,5 +75,6 @@ if minetest.get_modpath("ethereal") and not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:panda", S("Panda"), "mobs_panda_inv.png")

View File

@ -1,4 +1,4 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Penguin by D00Med
@ -10,14 +10,12 @@ stepheight = 0.6,
reach = 1,
hp_min = 5,
hp_max = 10,
armor = 200,
armor = 100,
collisionbox = {-0.2, -0.0, -0.2, 0.2, 0.5, 0.2},
visual = "mesh",
mesh = "mobs_penguin.b3d",
visual_size = {x = 0.25, y = 0.25},
textures = {
{"mobs_penguin.png"}
},
textures = {{"mobs_penguin.png"}},
sounds = {},
makes_footstep_sound = true,
walk_velocity = 1,
@ -34,12 +32,9 @@ stepheight = 0.6,
fear_height = 2,
animation = {
speed_normal = 15,
stand_start = 1,
stand_end = 20,
walk_start = 25,
walk_end = 45,
fly_start = 75, -- swim animation
fly_end = 95
stand_start = 1, stand_end = 20,
walk_start = 25, walk_end = 45,
fly_start = 75, fly_end = 95 -- swim animation
-- 50-70 is slide/water idle
},
fly_in = {"default:water_source", "default:water_flowing"},
@ -60,6 +55,7 @@ stepheight = 0.6,
end
})
-- where to spawn
if not mobs.custom_spawn_animal then
@ -75,5 +71,6 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:penguin", S("Penguin"), "mobs_penguin_inv.png")

26
rat.lua
View File

@ -1,26 +1,25 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Rat by KPavel and PilzAdam (B3D model by sirrobzeroone)
mobs:register_mob("mobs_animal:rat", {
stepheight = 0.6,
stepheight = 0.6,
type = "animal",
passive = true,
hp_min = 1,
hp_max = 4,
armor = 200,
armor = 100,
collisionbox = {-0.2, -1, -0.2, 0.2, -0.8, 0.2},
visual = "mesh",
mesh = "mobs_rat.b3d",
textures = {
{"mobs_rat.png"},
{"mobs_rat2.png"}
{"mobs_rat2.png"},
{"mobs_rat3.png"}
},
makes_footstep_sound = false,
sounds = {
random = "mobs_rat"
},
sounds = {random = "mobs_rat"},
walk_velocity = 1,
run_velocity = 2,
runaway = true,
@ -59,8 +58,8 @@ 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)
@ -68,6 +67,7 @@ local function rat_spawn(self, pos)
self.health = 100
end
-- where to spawn
if not mobs.custom_spawn_animal then
@ -83,21 +83,25 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:rat", S("Rat"), "mobs_rat_inv.png")
-- compatibility with older mobs mod
mobs:alias_mob("mobs:rat", "mobs_animal:rat") -- compatibility
mobs:alias_mob("mobs:rat", "mobs_animal:rat")
-- cooked rat, yummy!
minetest.register_craftitem(":mobs:rat_cooked", {
description = S("Cooked Rat"),
inventory_image = "mobs_cooked_rat.png",
on_use = minetest.item_eat(3),
groups = {food_rat = 1, flammable = 2}
groups = {food_rat = 1}
})
mobs.add_eatable("mobs:rat_cooked", 3)
minetest.register_craft({
type = "cooking",
output = "mobs:rat_cooked",

View File

@ -17,7 +17,7 @@ Wanders around eating grass/wheat and can be right-clicked with empty bucket to
---
### Kitten
Found on green grass these cute cats walk around and can be picked up and placed in inventory as pets or right-clicked with 4x live rats or raw fish (found in ethereal) and tamed. They can sometimes leave you little gifts of a hairball.
Found on green grass these cute cats walk around and can be picked up and placed in inventory as pets or right-clicked with 4x live rats or raw fish (found in ethereal) and tamed. They can sometimes leave you little gifts of a hairball, remember to check just incase it contains an item.
---
### Rat

View File

@ -8,3 +8,6 @@ mobs_animal.penguin (Enable Penguin) bool true
mobs_animal.rat (Enable Rat) bool true
mobs_animal.sheep (Enable Sheep) bool true
mobs_animal.warthog (Enable Warthog) bool true
mobs_animal.hairball (Enable Kitten Hairball drops) bool true
mobs_animal.eat_grass_block (Enable Cow/Sheep eating grass blocks) bool false

138
sheep.lua
View File

@ -1,7 +1,20 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- translation and localize function
local S = minetest.get_translator("mobs_animal")
local random = math.random
-- should sheep eat grass blocks and mess up the environment?
local eat_gb = minetest.settings:get_bool("mobs_animal.eat_grass_block")
local replace_what = { {"group:grass", "air", -1} }
if eat_gb then
table.insert(replace_what, {"default:dirt_with_grass", "default:dirt", -2})
end
-- sheep colour table
local all_colours = {
{"black", S("Black"), "#212121b0"}, -- referenced down in mobs:spawn
{"blue", S("Blue"), "#015dbb70"},
@ -20,7 +33,6 @@ local all_colours = {
{"yellow", S("Yellow"), "#fff80070"}
}
-- Sheep by PilzAdam/K Pavel, texture converted to minetest by AMMOnym from Summerfield pack
for _, col in ipairs(all_colours) do
@ -41,10 +53,7 @@ for _, col in ipairs(all_colours) do
for _2, col2 in ipairs(all_colours) do
if col2[1] == colr then
colr = col2[3]
break
end
if col2[1] == colr then colr = col2[3] ; break end
end
end
@ -56,8 +65,7 @@ for _, col in ipairs(all_colours) do
local col_text = "^[multiply:" .. col_override
if gotten then
wool_shave_text = shav_text
col_text = ""
wool_shave_text = shav_text ; col_text = ""
end
-- results in unneccesary brackets for shaved but these are ignored by engine
@ -77,8 +85,8 @@ for _, col in ipairs(all_colours) do
type = "animal",
passive = true,
hp_min = 8,
hp_max = 10,
armor = 200,
hp_max = 12,
armor = 100,
collisionbox = {-0.5, -1, -0.5, 0.5, 0.3, 0.5},
visual = "mesh",
mesh = "mobs_sheep.b3d",
@ -88,7 +96,8 @@ for _, col in ipairs(all_colours) do
gotten_texture = {"mobs_sheep_base.png^mobs_sheep_shaved.png"},
makes_footstep_sound = true,
sounds = {
random = "mobs_sheep"
random = "mobs_sheep",
replace = "default_dig_crumbly"
},
walk_velocity = 1,
run_velocity = 2,
@ -101,17 +110,13 @@ for _, col in ipairs(all_colours) do
lava_damage = 5,
light_damage = 0,
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
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.
die_loop = false,
die_rotate = true
speed_normal = 15, speed_run = 15,
stand_start = 0, stand_end = 80,
walk_start = 81, walk_end = 100,
-- no death animation so we'll re-use 2 standing frames at a speed of 1 fps
-- and have mob rotate while dying.
die_start = 1, die_end = 2, die_speed = 1,
die_loop = false, die_rotate = true
},
follow = {
"farming:wheat", "default:grass_1", "farming:barley",
@ -119,10 +124,7 @@ for _, col in ipairs(all_colours) do
},
view_range = 8,
replace_rate = 10,
replace_what = {
{"group:grass", "air", -1},
{"default:dirt_with_grass", "default:dirt", -2}
},
replace_what = replace_what,
fear_height = 3,
on_replace = function(self, pos, oldnode, newnode)
@ -183,24 +185,17 @@ for _, col in ipairs(all_colours) do
mob:set_properties({
textures = {textures},
visual_size = {
x = parent1.base_size.x * .5,
y = parent1.base_size.y * .5
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
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
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
}
})
@ -214,6 +209,17 @@ for _, col in ipairs(all_colours) do
return false
end,
-- fix any issue with horns by re-checking
on_spawn = function(self)
if self.child then return end -- baby sheep dont have horns
local textures = horn_texture_sel(self.attribute_horns, self.gotten)
self.object:set_properties({textures = {textures}})
self.base_texture = {textures}
end,
on_grown = function(self)
-- add the horns if we have horns when fully grown
@ -268,15 +274,14 @@ for _, col in ipairs(all_colours) do
-- are we giving a haircut>
if itemname == "mobs:shears" then
if self.gotten ~= false
or self.child ~= false
or name ~= self.owner
or not minetest.get_modpath("wool") then
if self.gotten ~= false or self.child ~= false
or name ~= self.owner or not minetest.get_modpath("wool") then
return
end
self.gotten = true -- shaved
self.drops = drops_gotten
self.food = 0 -- reset food
local obj = minetest.add_item(
self.object:get_pos(),
@ -284,12 +289,7 @@ for _, col in ipairs(all_colours) do
)
if obj then
obj:set_velocity({
x = random(-1, 1),
y = 5,
z = random(-1, 1)
})
obj:set_velocity({x = random(-1, 1), y = 5, z = random(-1, 1)})
end
item:add_wear(650) -- 100 uses
@ -307,18 +307,15 @@ for _, col in ipairs(all_colours) do
-- are we coloring?
if itemname:find("dye:") then
if self.gotten == false
and self.child == false
and self.tamed == true
and name == self.owner then
if self.gotten == false and self.child == false
and self.tamed == true and name == self.owner then
local colr = string.split(itemname, ":")[2]
for _,c in pairs(all_colours) do
-- only dye if colour option available and sheep not same colour
if c[1] == colr
and self.name ~= "mobs_animal:sheep_" .. colr then
if c[1] == colr and self.name ~= "mobs_animal:sheep_" .. colr then
local pos = self.object:get_pos()
@ -328,9 +325,11 @@ for _, col in ipairs(all_colours) do
if ent then
local prop = self.object:get_properties()
-- add old sheep attributes
ent.attribute_horns = self.attribute_horns
ent.nametag = self.nametag
ent._nametag = prop.nametag
ent.owner = name
ent.tamed = true
ent.protected = self.protected
@ -343,8 +342,7 @@ for _, col in ipairs(all_colours) do
ent.base_texture = {textures}
ent.object:set_properties({
textures = {textures},
nametag = self.nametag
textures = {textures}
})
-- remove old sheep
@ -381,6 +379,7 @@ for _, col in ipairs(all_colours) do
mobs:alias_mob("mobs:sheep_" .. col[1], "mobs_animal:sheep_" .. col[1])
end
-- where to spawn
if not mobs.custom_spawn_animal then
@ -445,8 +444,8 @@ if not mobs.custom_spawn_animal then
local entity = mobs:add_mob(pos,
{name = "mobs_animal:sheep_" .. types, child = lamb})
-- nil check
if not entity then return end
-- nil check
if not entity then return end
if not lamb then
-- Set horns attribute, lower height will be rarer.
@ -498,25 +497,32 @@ if not entity then return end
})
end
-- compatibility with older mobs mod
mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white") -- compatibility
mobs:alias_mob("mobs:sheep", "mobs_animal:sheep_white")
-- raw mutton
minetest.register_craftitem(":mobs:mutton_raw", {
description = S("Raw Mutton"),
inventory_image = "mobs_mutton_raw.png",
on_use = minetest.item_eat(2),
groups = {food_meat_raw = 1, food_mutton_raw = 1, flammable = 2}
groups = {food_meat_raw = 1, food_mutton_raw = 1}
})
-- cooked mutton
mobs.add_eatable("mobs:mutton_raw", 2)
-- cooked mutton and recipe
minetest.register_craftitem(":mobs:mutton_cooked", {
description = S("Cooked Mutton"),
inventory_image = "mobs_mutton_cooked.png",
on_use = minetest.item_eat(6),
groups = {food_meat = 1, food_mutton = 1, flammable = 2}
groups = {food_meat = 1, food_mutton = 1}
})
mobs.add_eatable("mobs:mutton_cooked", 6)
minetest.register_craft({
type = "cooking",
output = "mobs:mutton_cooked",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 609 B

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 788 B

BIN
textures/mobs_rat3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

View File

@ -1,4 +1,4 @@
-- Translation support
local S = minetest.get_translator("mobs_animal")
-- Warthog originally by KrupnoPavel, B3D model by sirrobzeroone
@ -13,15 +13,13 @@ mobs:register_mob("mobs_animal:pumba", {
attack_npcs = false,
reach = 2,
damage = 2,
hp_min = 5,
hp_min = 10,
hp_max = 15,
armor = 200,
armor = 100,
collisionbox = {-0.4, -0.01, -0.4, 0.4, 0.95, 0.4},
visual = "mesh",
mesh = "mobs_pumba.b3d",
textures = {
{"mobs_pumba.png"}
},
textures = {{"mobs_pumba.png"}},
makes_footstep_sound = true,
sounds = {
random = "mobs_pig",
@ -44,18 +42,12 @@ mobs:register_mob("mobs_animal:pumba", {
fear_height = 2,
animation = {
speed_normal = 15,
stand_start = 25,
stand_end = 55,
walk_start = 70,
walk_end = 100,
punch_start = 70,
punch_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.
die_loop = false,
die_rotate = true
stand_start = 25, stand_end = 55,
walk_start = 70, walk_end = 100,
punch_start = 70, punch_end = 100,
-- no specific dying animation, so use 2 frames at 1fps and rotate
die_start = 1, die_end = 2, die_speed = 1,
die_loop = false, die_rotate = true
},
on_rightclick = function(self, clicker)
@ -66,22 +58,18 @@ mobs:register_mob("mobs_animal:pumba", {
end
})
local spawn_on = {"default:dirt_with_grass"}
local spawn_by = {"group:grass"}
if minetest.get_mapgen_setting("mg_name") ~= "v6" then
spawn_on = {"default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"}
spawn_by = {"group:dry_grass"}
end
if minetest.get_modpath("ethereal") then
spawn_on = {"ethereal:mushroom_dirt"}
spawn_by = {"flowers:mushroom_brown", "flowers:mushroom_red"}
end
-- where to spawn
if not mobs.custom_spawn_animal then
local spawn_on = {"default:dirt_with_grass", "default:dry_dirt_with_dry_grass"}
local spawn_by = {"group:grass"}
if minetest.get_modpath("ethereal") then
spawn_on = {"ethereal:mushroom_dirt"}
spawn_by = {"flowers:mushroom_brown", "flowers:mushroom_red"}
end
mobs:spawn({
name = "mobs_animal:pumba",
nodes = spawn_on,
@ -95,30 +83,36 @@ if not mobs.custom_spawn_animal then
})
end
-- spawn egg
mobs:register_egg("mobs_animal:pumba", S("Warthog"), "mobs_pumba_inv.png")
-- old mobs mod compatibility
mobs:alias_mob("mobs:pumba", "mobs_animal:pumba") -- compatibility
mobs:alias_mob("mobs:pumba", "mobs_animal:pumba")
-- raw porkchop
minetest.register_craftitem(":mobs:pork_raw", {
description = S("Raw Porkchop"),
inventory_image = "mobs_pork_raw.png",
on_use = minetest.item_eat(4),
groups = {food_meat_raw = 1, food_pork_raw = 1, flammable = 2}
groups = {food_meat_raw = 1, food_pork_raw = 1}
})
-- cooked porkchop
mobs.add_eatable("mobs:pork_raw", 4)
-- cooked porkchop and recipe
minetest.register_craftitem(":mobs:pork_cooked", {
description = S("Cooked Porkchop"),
inventory_image = "mobs_pork_cooked.png",
on_use = minetest.item_eat(8),
groups = {food_meat = 1, food_pork = 1, flammable = 2}
groups = {food_meat = 1, food_pork = 1}
})
mobs.add_eatable("mobs:pork_cooked", 8)
minetest.register_craft({
type = "cooking",
output = "mobs:pork_cooked",