forked from mtcontrib/mobs_animal
fix evil bunny
This commit is contained in:
48
bunny.lua
48
bunny.lua
@ -5,10 +5,13 @@ local S = mobs.intllib_animal
|
||||
-- Bunny by ExeterDad
|
||||
|
||||
mobs:register_mob("mobs_animal:bunny", {
|
||||
stepheight = 0.6,
|
||||
type = "animal",
|
||||
passive = true,
|
||||
passive = false,--true,
|
||||
attack_type = "dogfight",
|
||||
attack_players = true,
|
||||
damage = 5,
|
||||
reach = 1,
|
||||
stepheight = 0.6,
|
||||
hp_min = 1,
|
||||
hp_max = 4,
|
||||
armor = 200,
|
||||
@ -61,26 +64,40 @@ stepheight = 0.6,
|
||||
|
||||
-- Monty Python tribute
|
||||
local item = clicker:get_wielded_item()
|
||||
local player_name = clicker:get_player_name()
|
||||
|
||||
if item:get_name() == "mobs:lava_orb" then
|
||||
if self.owner == player_name
|
||||
and item:get_name() == "mobs:lava_orb" then
|
||||
|
||||
-- take orb
|
||||
if not mobs.is_creative(clicker:get_player_name()) then
|
||||
item:take_item()
|
||||
clicker:set_wielded_item(item)
|
||||
end
|
||||
|
||||
self.base_texture = {"mobs_bunny_evil.png"}
|
||||
|
||||
self.object:set_properties({
|
||||
textures = {"mobs_bunny_evil.png"}
|
||||
-- set special bunny attributes
|
||||
local staticdata = minetest.serialize({
|
||||
type = "monster",
|
||||
hp_max = 20,
|
||||
health = 20,
|
||||
damage = 5,
|
||||
run_velocity = 3,
|
||||
passive = false,
|
||||
runaway = false,
|
||||
runaway_from = {},
|
||||
runaway_timer = 0,
|
||||
tamed = false,
|
||||
base_texture = {"mobs_bunny_evil.png"}
|
||||
})
|
||||
|
||||
self.type = "monster"
|
||||
self.health = 20
|
||||
self.passive = false
|
||||
self.runaway = false
|
||||
-- add evil bunny
|
||||
local obj = minetest.add_entity(
|
||||
self.object:get_pos(), "mobs_animal:bunny", staticdata)
|
||||
|
||||
return
|
||||
-- remove old bunny
|
||||
if obj:get_luaentity() then
|
||||
mobs:remove(self, true)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
@ -107,11 +124,10 @@ stepheight = 0.6,
|
||||
self.object:set_properties({textures = self.base_texture})
|
||||
end
|
||||
|
||||
return true -- run only once, false/nil runs every activation
|
||||
end,
|
||||
self.base_texture = self.texture
|
||||
|
||||
attack_type = "dogfight",
|
||||
damage = 5
|
||||
return true -- run only once, false/nil runs every activation
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user