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

fix evil bunny

This commit is contained in:
tenplus1 2023-05-28 12:19:49 +01:00
parent 24ae2e25a2
commit 87a7c09378
2 changed files with 36 additions and 25 deletions

View File

@ -5,10 +5,13 @@ local S = mobs.intllib_animal
-- Bunny by ExeterDad -- Bunny by ExeterDad
mobs:register_mob("mobs_animal:bunny", { mobs:register_mob("mobs_animal:bunny", {
stepheight = 0.6,
type = "animal", type = "animal",
passive = true, passive = false,--true,
attack_type = "dogfight",
attack_players = true,
damage = 5,
reach = 1, reach = 1,
stepheight = 0.6,
hp_min = 1, hp_min = 1,
hp_max = 4, hp_max = 4,
armor = 200, armor = 200,
@ -61,26 +64,40 @@ stepheight = 0.6,
-- Monty Python tribute -- Monty Python tribute
local item = clicker:get_wielded_item() 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 if not mobs.is_creative(clicker:get_player_name()) then
item:take_item() item:take_item()
clicker:set_wielded_item(item) clicker:set_wielded_item(item)
end end
self.base_texture = {"mobs_bunny_evil.png"} -- set special bunny attributes
local staticdata = minetest.serialize({
self.object:set_properties({ type = "monster",
textures = {"mobs_bunny_evil.png"} 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" -- add evil bunny
self.health = 20 local obj = minetest.add_entity(
self.passive = false self.object:get_pos(), "mobs_animal:bunny", staticdata)
self.runaway = false
return -- remove old bunny
if obj:get_luaentity() then
mobs:remove(self, true)
end
end end
end, end,
@ -107,11 +124,10 @@ stepheight = 0.6,
self.object:set_properties({textures = self.base_texture}) self.object:set_properties({textures = self.base_texture})
end end
return true -- run only once, false/nil runs every activation self.base_texture = self.texture
end,
attack_type = "dogfight", return true -- run only once, false/nil runs every activation
damage = 5 end
}) })

View File

@ -140,15 +140,10 @@ for _, col in ipairs(all_colours) do
["P1_H"] = {["P2_N"] = 50,["P2_H"] = 95} ["P1_H"] = {["P2_N"] = 50,["P2_H"] = 95}
} }
local p1 = "P1_N" -- no horns local p1 = parent1.attribute_horns and "P1_H" or "P1_N"
local p2 = "P2_N" -- no horns local p2 = parent2.attribute_horns and "P2_H" or "P2_N"
if parent1.attribute_horns then p1 = "P1_H" end
if parent2.attribute_horns then p2 = "P2_H" end
local horn_chance = breed_out[p1][p2] local horn_chance = breed_out[p1][p2]
local horns = random(100) <= horn_chance local horns = random(100) <= horn_chance
local pos = parent1.object:get_pos() local pos = parent1.object:get_pos()
-- can't see an easy way to pass horn attribute into -- can't see an easy way to pass horn attribute into