2015-03-19 00:10:30 +01:00
|
|
|
|
|
|
|
-- Bunny by ExeterDad
|
|
|
|
|
|
|
|
mobs:register_mob("mobs:bunny", {
|
|
|
|
-- animal, monster, npc
|
|
|
|
type = "animal",
|
|
|
|
-- is it aggressive
|
|
|
|
passive = true,
|
|
|
|
-- health & armor
|
2015-05-22 10:37:17 +02:00
|
|
|
hp_min = 3, hp_max = 6, armor = 200,
|
2015-03-19 00:10:30 +01:00
|
|
|
-- textures and model
|
|
|
|
collisionbox = {-0.268, -0.5, -0.268, 0.268, 0.167, 0.268},
|
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_bunny.b3d",
|
2015-05-22 10:37:17 +02:00
|
|
|
drawtype = "front",
|
Update mobs mod
- api.lua (many improves, chicken egg more frequent, NPC attack nearly
mobs, textures code, etc…)
- Bee (spawn on group:flower now, textures code updated)
- Bunny (textures code updated)
- Chicken (two times more eggs, textures code updated)
- Cow (textures code updated)
- Creeper (finish reorganize the code, textures code updated, new eggs
inventory texture)
- Dirt Monster (textures code updated)
- Dungeon Master (textures code updated)
- init.lua (small credits tweaks)
- Kitten (textures code updated, now drop sometimes farming:string)
- Lava Flan (textures code updated, now 3 can spawn per chunck)
- Mese Monster (textures code updated)
- NPC (textures code updated, revert give raw meat versus health code
for tests)
- Oerkki (textures code updated, now 1 light damage)
- Rat (textures code updated)
- Sand Monster (textures code updated)
- Sheep (textures code updated, now give 2 to 3 wool when sheared)
- Spider (textures code updated, change credits, comments our
modifications)
- Stone Monster (textures code updated)
- Tree Monster (textures code updated)
- Warthog (textures code updated)
- Wolf (finish reorganize the code, textures code updated, add spawner
egg and an inventory texture)
- Tweaks some sounds
2015-03-31 19:32:46 +02:00
|
|
|
textures = {
|
|
|
|
{"mobs_bunny_grey.png"},
|
|
|
|
{"mobs_bunny_brown.png"},
|
|
|
|
{"mobs_bunny_white.png"},
|
2015-03-19 00:10:30 +01:00
|
|
|
},
|
|
|
|
-- sounds
|
|
|
|
sounds = {},
|
|
|
|
makes_footstep_sound = false,
|
|
|
|
-- speed and jump
|
2015-05-22 10:37:17 +02:00
|
|
|
walk_velocity = 1, run_velocity = 2,
|
2015-03-19 00:10:30 +01:00
|
|
|
jump = true,
|
2015-05-22 10:37:17 +02:00
|
|
|
-- drops meat when dead
|
2015-03-19 00:10:30 +01:00
|
|
|
drops = {
|
|
|
|
{name = "mobs:meat_raw",
|
|
|
|
chance = 1, min = 1, max = 2,},
|
|
|
|
},
|
|
|
|
-- damaged by
|
|
|
|
water_damage = 1,
|
2015-04-11 21:45:03 +02:00
|
|
|
lava_damage = 4,
|
2015-03-19 00:10:30 +01:00
|
|
|
light_damage = 0,
|
|
|
|
-- model animation
|
|
|
|
animation = {
|
|
|
|
speed_normal = 15,
|
|
|
|
stand_start = 1, stand_end = 15,
|
|
|
|
walk_start = 16, walk_end = 24,
|
2015-05-22 10:37:17 +02:00
|
|
|
punch_start = 16, punch_end = 24,
|
2015-03-19 00:10:30 +01:00
|
|
|
},
|
|
|
|
-- follows carrot from farming redo
|
|
|
|
follow = "farming:carrot",
|
2015-03-20 22:57:10 +01:00
|
|
|
view_range = 8,
|
|
|
|
-- eat carrots
|
|
|
|
replace_rate = 80,
|
|
|
|
replace_what = {"farming:carrot_7", "farming:carrot_8", "farming_plus:carrot"},
|
|
|
|
replace_with = "air",
|
2015-03-19 00:10:30 +01:00
|
|
|
-- right click to pick up rabbit
|
|
|
|
on_rightclick = function(self, clicker)
|
|
|
|
local item = clicker:get_wielded_item()
|
2015-05-22 10:37:17 +02:00
|
|
|
local name = clicker:get_player_name()
|
|
|
|
|
2015-04-11 21:45:03 +02:00
|
|
|
if item:get_name() == "farming_plus:carrot_item"
|
|
|
|
or item:get_name() == "farming:carrot" then
|
2015-05-22 10:37:17 +02:00
|
|
|
-- take item
|
2015-03-19 00:10:30 +01:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
|
|
|
item:take_item()
|
|
|
|
clicker:set_wielded_item(item)
|
|
|
|
end
|
2015-05-22 10:37:17 +02:00
|
|
|
-- feed and tame
|
2015-03-19 00:10:30 +01:00
|
|
|
self.food = (self.food or 0) + 1
|
2015-05-22 10:37:17 +02:00
|
|
|
if self.food > 3 then
|
2015-03-19 00:10:30 +01:00
|
|
|
self.food = 0
|
|
|
|
self.tamed = true
|
2015-05-22 10:37:17 +02:00
|
|
|
-- make owner
|
|
|
|
if not self.owner or self.owner == "" then
|
|
|
|
self.owner = name
|
|
|
|
end
|
2015-03-19 00:10:30 +01:00
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
2015-05-22 10:37:17 +02:00
|
|
|
-- Monty Python tribute
|
|
|
|
if item:get_name() == "mobs:lava_orb" then
|
|
|
|
-- take item
|
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
|
|
|
item:take_item()
|
|
|
|
clicker:set_wielded_item(item)
|
|
|
|
end
|
|
|
|
self.object:set_properties({
|
|
|
|
textures = {"mobs_bunny_evil.png"},
|
|
|
|
})
|
|
|
|
self.type = "monster"
|
|
|
|
self.state = "attack"
|
|
|
|
self.object:set_hp(20)
|
|
|
|
return
|
|
|
|
end
|
2015-04-11 21:45:03 +02:00
|
|
|
|
|
|
|
if clicker:is_player()
|
|
|
|
and clicker:get_inventory()
|
|
|
|
and self.child == false
|
|
|
|
and clicker:get_inventory():room_for_item("main", "mobs:bunny") then
|
2015-05-22 10:37:17 +02:00
|
|
|
|
|
|
|
-- pick up if owner
|
|
|
|
if self.owner == name then
|
|
|
|
clicker:get_inventory():add_item("main", "mobs:bunny")
|
|
|
|
self.object:remove()
|
|
|
|
-- cannot pick up if not tamed
|
|
|
|
elseif not self.owner or self.owner == "" then
|
|
|
|
minetest.chat_send_player(name, "Not tamed!")
|
|
|
|
-- cannot pick up if not owner
|
|
|
|
elseif self.owner ~= name then
|
|
|
|
minetest.chat_send_player(name, "Not owner!")
|
|
|
|
end
|
2015-03-19 00:10:30 +01:00
|
|
|
end
|
2015-05-22 10:37:17 +02:00
|
|
|
end,
|
|
|
|
attack_type = "dogfight",
|
|
|
|
damage = 5,
|
2015-03-19 00:10:30 +01:00
|
|
|
})
|
|
|
|
|
2015-03-27 23:12:03 +01:00
|
|
|
mobs:register_spawn("mobs:bunny", {"default:dirt_with_grass"}, 20, 8, 10000, 1, 31000)
|
2015-03-20 22:57:10 +01:00
|
|
|
mobs:register_egg("mobs:bunny", "Bunny", "mobs_bunny_inv.png", 0)
|