1
0
mirror of https://codeberg.org/tenplus1/mobs_animal.git synced 2024-12-22 08:50:26 +01:00

tweaked kitten, added hairball item

This commit is contained in:
TenPlus1 2018-08-31 10:33:25 +01:00
parent dedcddfdd6
commit 3f724507b2
4 changed files with 79 additions and 4 deletions

View File

@ -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,
})

View File

@ -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

View File

@ -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

BIN
textures/mobs_hairball.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B