From 3f724507b20bb680e4ee88758257a2a64381d80a Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Fri, 31 Aug 2018 10:33:25 +0100 Subject: [PATCH] tweaked kitten, added hairball item --- kitten.lua | 78 ++++++++++++++++++++++++++++++++++++- lucky_block.lua | 1 + readme.md | 4 +- textures/mobs_hairball.png | Bin 0 -> 363 bytes 4 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 textures/mobs_hairball.png diff --git a/kitten.lua b/kitten.lua index f16355d..cc46c3b 100644 --- a/kitten.lua +++ b/kitten.lua @@ -32,6 +32,7 @@ reach = 1, random = "mobs_kitten", }, walk_velocity = 0.6, + walk_chance = 15, run_velocity = 2, runaway = true, jump = false, @@ -47,15 +48,54 @@ reach = 1, stand_end = 192, walk_start = 0, walk_end = 96, + stoodup_start = 0, + stoodup_end = 0, }, follow = {"mobs_animal:rat", "ethereal:fish_raw", "mobs_fish:clownfish", "mobs_fish:tropical"}, view_range = 8, + on_rightclick = function(self, clicker) 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 + + -- by right-clicking owner can switch between staying and walking + if self.owner and self.owner == clicker:get_player_name() then + + if self.order ~= "stand" then + self.order = "stand" + mobs:set_animation(self, "stand") + else + self.order = "" + mobs:set_animation(self, "stoodup") + end + end + end, + + do_custom = function(self, dtime) + + self.hairball_timer = (self.hairball_timer or 0) + dtime + if self.hairball_timer < 10 then + return + end + self.hairball_timer = 0 + + if self.child + or math.random(1, 10) > 1 then + return + end + + local pos = self.object:get_pos() + + minetest.add_item(pos, "mobs:hairball") + + minetest.sound_play("default_dig_snappy", { + pos = pos, + gain = 1.0, + max_hear_distance = 5, + }) + end, }) @@ -73,7 +113,7 @@ mobs:spawn({ interval = 60, chance = 10000, -- 22000 min_height = 5, - max_height = 200, + max_height = 50, day_toggle = true, }) @@ -82,3 +122,37 @@ mobs:register_egg("mobs_animal:kitten", S("Kitten"), "mobs_kitten_inv.png", 0) mobs:alias_mob("mobs:kitten", "mobs_animal:kitten") -- compatibility + + +local hairball_items = { + "default:stick", "default:coal_lump", "default:dry_shrub", "flowers:rose", + "mobs_animal:rat", "default:grass_1", "farming:seed_wheat", "dye:green", + "farming:seed_cotton", "default:flint", "default:sapling", "dye:white", + "default:clay_lump", "default:paper", "default:dry_grass_1", "dye:red", + "farming:string", "mobs:chicken_feather", "default:acacia_bush_sapling", + "default:bush_sapling", "default:copper_lump", "default:iron_lump", +} + +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() + local dir = user:get_look_dir() + 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)] + + minetest.add_item(newpos, {name = item}) + + minetest.sound_play("default_place_node_hard", { + pos = newpos, + gain = 1.0, + max_hear_distance = 5, + }) + + itemstack:take_item() + + return itemstack + end, +}) diff --git a/lucky_block.lua b/lucky_block.lua index 94befc3..c519a4c 100644 --- a/lucky_block.lua +++ b/lucky_block.lua @@ -15,6 +15,7 @@ if minetest.get_modpath("lucky_block") then {"dro", {"mobs:bucket_milk"}, 8}, {"spw", "mobs:kitten", 2}, {"exp"}, + {"dro", {"mobs:hairball"}, 3}, }) if minetest.registered_nodes["default:nyancat"] then diff --git a/readme.md b/readme.md index 55b5a83..275193d 100644 --- a/readme.md +++ b/readme.md @@ -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. +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. --- ### Rat @@ -42,4 +42,4 @@ These monochrome cuties spawn in Ethereal's bamboo biome and can be tamed with b --- *Note: After breeding, animals need to rest for 4 minutes and baby animals take 4 minutes to grow up, also feeding them helps them grow quicker...* -#### Lucky Blocks: 14 +#### Lucky Blocks: 15 diff --git a/textures/mobs_hairball.png b/textures/mobs_hairball.png new file mode 100644 index 0000000000000000000000000000000000000000..0628c95b7b50343359316d67765919d4090ad0a8 GIT binary patch literal 363 zcmV-x0hIoUP)Wf;lp#At5VuiOJYTj-3%zRmjh-X{t_L>g~~;-t!$o z|9ZV$pVZqAY!33I_g6R!B>SzYM#idBUEhzTy`v*FDArz#4%!kRlu%p8=qx#@!CL4~ zJtiJ}5<>W}ur@{?K~4eOSxd|eN9~FVV;6F|G#Uz8GuOpY6&syJk-lJ(tmVvv40g7B zzfV?mTOwpN_Ve7M38_V7GGoDAOp_FqMS~DexrZT%Ww|x7b}gCTc++lG8ll_AKs<$k z$dBVjJY#Hnq-rz%6TMD+LMsx$-FIgIy3Krc-F>oFB7;AU_XWNRK2x1b{8j(}002ov JPDHLkV1k&~l)3-_ literal 0 HcmV?d00001