From f4204dee1042f937a988f2ceafc6467c62343d12 Mon Sep 17 00:00:00 2001 From: Milan2018 Date: Sat, 28 Dec 2019 16:10:59 +0100 Subject: [PATCH] =?UTF-8?q?Nahr=C3=A1t=20soubory=20do=20'mobs=5Fanimal'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobs_animal/lucky_block.lua | 31 +++++++++++ mobs_animal/mod.conf | 5 ++ mobs_animal/panda.lua | 86 ++++++++++++++++++++++++++++++ mobs_animal/penguin.lua | 73 ++++++++++++++++++++++++++ mobs_animal/rat.lua | 101 ++++++++++++++++++++++++++++++++++++ 5 files changed, 296 insertions(+) create mode 100644 mobs_animal/lucky_block.lua create mode 100644 mobs_animal/mod.conf create mode 100644 mobs_animal/panda.lua create mode 100644 mobs_animal/penguin.lua create mode 100644 mobs_animal/rat.lua diff --git a/mobs_animal/lucky_block.lua b/mobs_animal/lucky_block.lua new file mode 100644 index 0000000..e88b20d --- /dev/null +++ b/mobs_animal/lucky_block.lua @@ -0,0 +1,31 @@ + +if minetest.get_modpath("lucky_block") 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"}, 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.registered_nodes["default:nyancat"] then + lucky_block:add_blocks({ + {"tro", "default:nyancat", "mobs_kitten", true}, + }) + end +end diff --git a/mobs_animal/mod.conf b/mobs_animal/mod.conf new file mode 100644 index 0000000..0b4396b --- /dev/null +++ b/mobs_animal/mod.conf @@ -0,0 +1,5 @@ +name = mobs_animal +release = 1280 +author = TenPlus1 +description = Adds farm animals. +title = Mobs Animal diff --git a/mobs_animal/panda.lua b/mobs_animal/panda.lua new file mode 100644 index 0000000..427486a --- /dev/null +++ b/mobs_animal/panda.lua @@ -0,0 +1,86 @@ + +local S = mobs.intllib + + +-- Panda by AspireMint (CC BY-SA 3.0) + +mobs:register_mob("mobs_animal:panda", { +stepheight = 0.6, + type = "animal", + passive = false, + attack_type = "dogfight", + group_attack = false, + owner_loyal = true, + attack_npcs = false, + reach = 2, + damage = 3, + hp_min = 10, + hp_max = 24, + armor = 200, + collisionbox = {-0.4, -0.45, -0.4, 0.4, 0.45, 0.4}, + visual = "mesh", + mesh = "mobs_panda.b3d", + textures = { + {"mobs_panda.png"}, + }, + makes_footstep_sound = true, + sounds = { + random = "mobs_panda", + attack = "mobs_panda", + }, + walk_chance = 5, + walk_velocity = 0.5, + run_velocity = 1.5, + jump = false, + jump_height = 6, + follow = {"ethereal:bamboo"}, + view_range = 8, + drops = { + {name = "mobs:meat_raw", chance = 1, min = 1, max = 2}, + }, + water_damage = 0, + lava_damage = 5, + light_damage = 0, + 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 + }, + 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, +}) + +if minetest.get_modpath("ethereal") then + + mobs:spawn({ + name = "mobs_animal:panda", + nodes = {"ethereal:bamboo_dirt"}, + neighbors = {"group:grass"}, + min_light = 14, + interval = 60, + chance = 8000, -- 15000 + min_height = 10, + max_height = 80, + day_toggle = true, + }) +end + +mobs:register_egg("mobs_animal:panda", S("Panda"), "wool_green.png", 1) diff --git a/mobs_animal/penguin.lua b/mobs_animal/penguin.lua new file mode 100644 index 0000000..2ee14b9 --- /dev/null +++ b/mobs_animal/penguin.lua @@ -0,0 +1,73 @@ + +local S = mobs.intllib + + +-- Penguin by D00Med + +mobs:register_mob("mobs_animal:penguin", { +stepheight = 0.6, + 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", "default:water_flowing"}, + floats = 0, + follow = {"ethereal:fish_raw", "mobs_fish:clownfish", "mobs_fish:tropical"}, + 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 = 14, + interval = 60, + chance = 20000, + min_height = 0, + max_height = 200, + day_toggle = true, +}) + + +mobs:register_egg("mobs_animal:penguin", S("Penguin"), "default_snow.png", 1) diff --git a/mobs_animal/rat.lua b/mobs_animal/rat.lua new file mode 100644 index 0000000..27017fe --- /dev/null +++ b/mobs_animal/rat.lua @@ -0,0 +1,101 @@ + +local S = mobs.intllib + + +-- Rat by PilzAdam + +mobs:register_mob("mobs_animal:rat", { +stepheight = 0.6, + type = "animal", + passive = true, + hp_min = 1, + hp_max = 4, + armor = 200, + 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"}, + }, + makes_footstep_sound = false, + sounds = { + random = "mobs_rat", + }, + walk_velocity = 1, + run_velocity = 2, + runaway = true, + jump = true, + water_damage = 0, + 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, +--[[ + do_custom = function(self, dtime) + + self.rat_timer = (self.rat_timer or 0) + dtime + + if self.rat_timer < 1 then return end -- every 1 second + + self.rat_timer = 0 + + local pos = self.object:get_pos() + + print("rat pos", pos.x, pos.y, pos.z, dtime) + + return false -- return but skip doing rest of API + end, +]] +--[[ + on_blast = function(obj, damage) + print ("--- damage is", damage) + print ("--- mob is", obj.object:get_luaentity().name) + -- return's do_damage, do_knockback and drops + return false, true, {"default:mese"} + end, +]] +}) + + +local function rat_spawn(self, pos) + self = self:get_luaentity() + print (self.name, pos.x, pos.y, pos.z) + self.hp_max = 100 + self.health = 100 +end + +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:register_egg("mobs_animal:rat", S("Rat"), "mobs_rat_inventory.png", 0) + + +mobs:alias_mob("mobs:rat", "mobs_animal:rat") -- compatibility + + +-- 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}, +}) + +minetest.register_craft({ + type = "cooking", + output = "mobs:rat_cooked", + recipe = "mobs_animal:rat", + cooktime = 5, +})