master
Juraj Vajda 2017-07-15 18:00:43 +02:00
parent 9c948e7788
commit 39bc4b7ca3
9 changed files with 134 additions and 58 deletions

View File

@ -9,7 +9,7 @@ mobs:register_mob("mobs_animal:bee", {
hp_min = 1,
hp_max = 2,
armor = 200,
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.2, 0.2},
collisionbox = {-0.2, -0.01, -0.2, 0.2, 0.5, 0.2},
visual = "mesh",
mesh = "mobs_bee.x",
textures = {

View File

@ -28,7 +28,7 @@ mobs:register_mob("mobs_animal:bunny", {
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
},
water_damage = 1,
water_damage = 2,
lava_damage = 4,
light_damage = 0,
fear_height = 2,
@ -49,9 +49,9 @@ mobs:register_mob("mobs_animal:bunny", {
on_rightclick = function(self, clicker)
-- feed or tame
if mobs:feed_tame(self, clicker, 4, true, true) then
return
end
if mobs:feed_tame(self, clicker, 4, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end
-- Monty Python tribute
local item = clicker:get_wielded_item()
@ -73,7 +73,6 @@ mobs:register_mob("mobs_animal:bunny", {
return
end
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
end,
attack_type = "dogfight",

View File

@ -34,7 +34,7 @@ mobs:register_mob("mobs_animal:chicken", {
drops = {
{name = "mobs:chicken_raw", chance = 1, min = 2, max = 2},
},
water_damage = 1,
water_damage = 2,
lava_damage = 5,
light_damage = 0,
fall_damage = 0,
@ -52,18 +52,21 @@ mobs:register_mob("mobs_animal:chicken", {
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 30, 50, 80, false, nil)
if mobs:feed_tame(self, clicker, 8, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 30, 50, 80, false, nil) then return end
end,
do_custom = function(self)
do_custom = function(self, dtime)
self.egg_timer = (self.egg_timer or 0) + dtime
if self.egg_timer < 10 then
return
end
self.egg_timer = 0
if self.child
or math.random(1, 5000) > 1 then
or math.random(1, 100) > 1 then
return
end
@ -105,14 +108,14 @@ mobs:register_arrow("mobs_animal:egg_entity", {
velocity = 6,
hit_player = function(self, player)
player:punch(self.object, 1.0, {
player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 1},
}, nil)
end,
hit_mob = function(self, player)
player:punch(self.object, 1.0, {
player:punch(minetest.get_player_by_name(self.playername) or self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 1},
}, nil)
@ -120,23 +123,23 @@ mobs:register_arrow("mobs_animal:egg_entity", {
hit_node = function(self, pos, node)
local num = math.random(1, 10)
if math.random(1, 10) > 1 then
return
end
pos.y = pos.y + 1
if num == 1 then
local nod = minetest.get_node_or_nil(pos)
pos.y = pos.y + 1
if not nod
or not minetest.registered_nodes[nod.name]
or minetest.registered_nodes[nod.name].walkable == true then
return
end
local nod = minetest.get_node_or_nil(pos)
if not nod
or not minetest.registered_nodes[nod.name]
or minetest.registered_nodes[nod.name].walkable == true then
return
end
local mob = minetest.add_entity(pos, "mobs_animal:chicken")
local mob = minetest.add_entity(pos, "mobs_animal:chicken")
local ent2 = mob:get_luaentity()
mob:set_properties({
textures = ent2.child_texture[1],
visual_size = {
@ -152,11 +155,10 @@ mobs:register_arrow("mobs_animal:egg_entity", {
ent2.base_colbox[6] / 2
},
})
ent2.child = true
ent2.tamed = true
ent2.owner = self.playername
end
end
})

19
cow.lua
View File

@ -30,7 +30,8 @@ mobs:register_mob("mobs_animal:cow", {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 3},
-- {name = "mobs:leather", chance = 1, min = 1, max = 2},
},
water_damage = 1,
water_damage = 2,
floats = 0,
lava_damage = 5,
light_damage = 0,
animation = {
@ -46,17 +47,21 @@ mobs:register_mob("mobs_animal:cow", {
punch_end = 100,
},
follow = "farming:wheat",
view_range = 7,
view_range = 8,
owner_loyal = true,
replace_rate = 10,
replace_what = {"default:grass_3", "default:grass_4", "default:grass_5", "farming:wheat_8"},
replace_what = {
{"group:grass", "air", 0},
{"default:dirt_with_grass", "default:dirt", -1}
},
replace_with = "air",
fear_height = 2,
on_rightclick = function(self, clicker)
-- feed or tame
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
if mobs:feed_tame(self, clicker, 8, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end
local tool = clicker:get_wielded_item()
local name = clicker:get_player_name()
@ -92,8 +97,6 @@ mobs:register_mob("mobs_animal:cow", {
return
end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
end,
})

View File

@ -3,8 +3,14 @@ local path = minetest.get_modpath("mobs_animal")
-- Intllib
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
if minetest.global_exists("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
S = intllib.make_gettext_pair()
else
-- Old method using text files.
S = intllib.Getter()
end
else
S = function(s) return s end
end
@ -20,5 +26,6 @@ dofile(path .. "/warthog.lua") -- KrupnoPavel
dofile(path .. "/bee.lua") -- KrupnoPavel
-- dofile(path .. "/bunny.lua") -- ExeterDad
-- dofile(path .. "/kitten.lua") -- Jordach/BFD
-- dofile(path .. "/penguin.lua") -- D00Med
print (S("[MOD] Mobs Redo 'Animals' loaded"))

View File

@ -30,7 +30,7 @@ mobs:register_mob("mobs_animal:kitten", {
drops = {
{name = "farming:string", chance = 1, min = 1, max = 1},
},
water_damage = 1,
water_damage = 2,
lava_damage = 5,
fear_height = 3,
animation = {
@ -44,11 +44,9 @@ mobs:register_mob("mobs_animal:kitten", {
view_range = 8,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 4, true, true) then
return
end
mobs:capture_mob(self, clicker, 50, 50, 90, false, nil)
if mobs:feed_tame(self, clicker, 4, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) then return end
end
})

70
penguin.lua Normal file
View File

@ -0,0 +1,70 @@
local S = mobs.intllib
-- Penguin by D00Med
mobs:register_mob("mobs_animal:penguin", {
type = "animal",
passive = true,
reach = 1,
hp_min = 5,
hp_max = 10,
armor = 200,
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"},
},
sounds = {},
makes_footstep_sound = true,
walk_velocity = 1,
run_velocity = 2,
runaway = true,
jump = false,
stepheight = 1.1,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 1, max = 1},
},
water_damage = 0,
lava_damage = 4,
light_damage = 0,
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,
-- 50-70 is slide/water idle
},
fly_in = "default:water_source",
floats = 0,
follow = {"ethereal:fish_raw"},
view_range = 5,
on_rightclick = function(self, clicker)
-- feed or tame
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,
})
mobs:spawn({
name = "mobs_animal:penguin",
nodes = {"default:snowblock"},
min_light = 10,
chance = 20000,
min_height = 0,
day_toggle = true,
})
mobs:register_egg("mobs_animal:penguin", S("Penguin"), "default_snow.png", 1)

View File

@ -49,7 +49,7 @@ for _, col in pairs(all_colours) do
{name = "mobs:meat_raw", chance = 1, min = 1, max = 2},
--{name = "wool:"..col[1], chance = 1, min = 1, max = 1},
},
water_damage = 1,
water_damage = 2,
lava_damage = 5,
light_damage = 0,
animation = {
@ -165,10 +165,10 @@ for _, col in pairs(all_colours) do
return
end
-- protect mod with mobs:protector item
mobs:protect(self, clicker)
if mobs:protect(self, clicker) then return end
--are we capturing?
mobs:capture_mob(self, clicker, 0, 5, 60, false, nil)
if mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) then return end
end
})

View File

@ -32,7 +32,7 @@ mobs:register_mob("mobs_animal:pumba", {
drops = {
{name = "mobs:pork_raw", chance = 1, min = 1, max = 3},
},
water_damage = 1,
water_damage = 2,
lava_damage = 5,
light_damage = 0,
fear_height = 2,
@ -47,12 +47,9 @@ mobs:register_mob("mobs_animal:pumba", {
},
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 8, true, true) then
return
end
mobs:protect(self, clicker)
mobs:capture_mob(self, clicker, 0, 5, 50, false, nil)
if mobs:feed_tame(self, clicker, 8, 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,
})