summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2018-08-31 10:33:25 +0100
committerTenPlus1 <kinsellaja@yahoo.com>2018-08-31 10:33:25 +0100
commit3f724507b20bb680e4ee88758257a2a64381d80a (patch)
treea5e52215f9381cbd55b31dec6e0d3e29396e41bd
parentdedcddfdd61e59819063d5432e285972697f4880 (diff)
tweaked kitten, added hairball item
-rw-r--r--kitten.lua78
-rw-r--r--lucky_block.lua1
-rw-r--r--readme.md4
-rw-r--r--textures/mobs_hairball.pngbin0 -> 363 bytes
4 files changed, 79 insertions, 4 deletions
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 0000000..0628c95
--- /dev/null
+++ b/textures/mobs_hairball.png
Binary files differ