diff --git a/bee.lua b/bee.lua index 0e1d228..625f19d 100644 --- a/bee.lua +++ b/bee.lua @@ -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 = { diff --git a/bunny.lua b/bunny.lua index ea2ad2f..3fb99f7 100644 --- a/bunny.lua +++ b/bunny.lua @@ -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", diff --git a/chicken.lua b/chicken.lua index eb0f934..bca8323 100644 --- a/chicken.lua +++ b/chicken.lua @@ -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 }) diff --git a/cow.lua b/cow.lua index 3abb360..87e2dda 100644 --- a/cow.lua +++ b/cow.lua @@ -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, }) diff --git a/init.lua b/init.lua index 6f8d3b1..d94f303 100644 --- a/init.lua +++ b/init.lua @@ -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")) diff --git a/kitten.lua b/kitten.lua index e89043e..e26e875 100644 --- a/kitten.lua +++ b/kitten.lua @@ -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 }) diff --git a/penguin.lua b/penguin.lua new file mode 100644 index 0000000..f8bae1b --- /dev/null +++ b/penguin.lua @@ -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) \ No newline at end of file diff --git a/sheep.lua b/sheep.lua index a36dafd..bb74746 100644 --- a/sheep.lua +++ b/sheep.lua @@ -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 }) diff --git a/warthog.lua b/warthog.lua index 2bd9a26..ccca12c 100644 --- a/warthog.lua +++ b/warthog.lua @@ -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, })