1
0
mirror of https://codeberg.org/tenplus1/mobs_animal.git synced 2025-07-26 03:50:22 +02:00

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
2025-03-20 12:25:20 +01:00
18 changed files with 138 additions and 55 deletions

38
cow.lua
View File

@ -1,6 +1,15 @@
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",
@ -21,7 +30,10 @@ mobs:register_mob("mobs_animal:cow", {
{"mobs_cow2.png"}
},
makes_footstep_sound = true,
sounds = {random = "mobs_cow"},
sounds = {
random = "mobs_cow",
replace = "default_dig_crumbly"
},
walk_velocity = 1,
run_velocity = 2,
jump = true,
@ -41,7 +53,7 @@ mobs:register_mob("mobs_animal:cow", {
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
die_start = 165, die_end = 185, die_speed = 25, die_loop = false
},
follow = {
"farming:wheat", "default:grass_1", "farming:barley",
@ -49,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,