2017-07-05 01:15:46 +00:00
|
|
|
--MCmobs v0.4
|
|
|
|
--maikerumine
|
|
|
|
--made for MC like Survival game
|
|
|
|
--License for code WTFPL and otherwise stated in readmes
|
|
|
|
|
2019-03-07 19:43:39 +00:00
|
|
|
local S = minetest.get_translator("mobs_mc")
|
2017-07-05 01:15:46 +00:00
|
|
|
|
|
|
|
--###################
|
|
|
|
--################### PARROT
|
|
|
|
--###################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mobs:register_mob("mobs_mc:parrot", {
|
|
|
|
type = "npc",
|
2020-04-11 00:46:03 +00:00
|
|
|
spawn_class = "passive",
|
2017-07-05 01:15:46 +00:00
|
|
|
pathfinding = 1,
|
|
|
|
hp_min = 6,
|
|
|
|
hp_max = 6,
|
2020-12-06 14:46:42 +00:00
|
|
|
xp_min = 1,
|
|
|
|
xp_max = 3,
|
2021-04-21 17:05:46 +00:00
|
|
|
tilt_fly = true,
|
2021-04-25 05:44:46 +00:00
|
|
|
collisionbox = {-0.25, 0, -0.25, 0.25, 0.9, 0.25},
|
|
|
|
eye_height = 0.45,
|
2017-07-05 01:15:46 +00:00
|
|
|
visual = "mesh",
|
|
|
|
mesh = "mobs_mc_parrot.b3d",
|
|
|
|
textures = {{"mobs_mc_parrot_blue.png"},{"mobs_mc_parrot_green.png"},{"mobs_mc_parrot_grey.png"},{"mobs_mc_parrot_red_blue.png"},{"mobs_mc_parrot_yellow_blue.png"}},
|
|
|
|
visual_size = {x=3, y=3},
|
2021-04-17 17:13:45 +00:00
|
|
|
rotate = 270,
|
2017-07-05 01:15:46 +00:00
|
|
|
walk_velocity = 3,
|
|
|
|
run_velocity = 5,
|
2020-12-05 16:14:56 +00:00
|
|
|
sounds = {
|
|
|
|
random = "mobs_mc_parrot_random",
|
|
|
|
damage = {name="mobs_mc_parrot_hurt", gain=0.3},
|
|
|
|
death = {name="mobs_mc_parrot_death", gain=0.6},
|
2020-12-05 22:37:12 +00:00
|
|
|
eat = "mobs_mc_animal_eat_generic",
|
2020-12-05 16:14:56 +00:00
|
|
|
distance = 16,
|
|
|
|
},
|
2017-07-05 01:15:46 +00:00
|
|
|
drops = {
|
|
|
|
{name = mobs_mc.items.feather,
|
|
|
|
chance = 1,
|
|
|
|
min = 1,
|
2020-12-23 16:41:42 +00:00
|
|
|
max = 2,
|
|
|
|
looting = "common",},
|
2017-07-05 01:15:46 +00:00
|
|
|
},
|
|
|
|
animation = {
|
|
|
|
stand_speed = 50,
|
|
|
|
walk_speed = 50,
|
2020-12-05 02:21:39 +00:00
|
|
|
fly_speed = 50,
|
|
|
|
stand_start = 30,
|
|
|
|
stand_end = 45,
|
|
|
|
fly_start = 30,
|
|
|
|
fly_end = 45,
|
|
|
|
walk_start = 30,
|
|
|
|
walk_end = 45,
|
|
|
|
-- TODO: actual walk animation
|
|
|
|
--walk_start = 0,
|
|
|
|
--walk_end = 20,
|
|
|
|
|
|
|
|
-- TODO: more unused animations between 45 and 130
|
2017-07-05 01:15:46 +00:00
|
|
|
},
|
|
|
|
fall_damage = 0,
|
|
|
|
fall_speed = -2.25,
|
|
|
|
attack_type = "dogfight",
|
|
|
|
floats = 1,
|
|
|
|
physical = true,
|
|
|
|
fly = true,
|
2020-12-05 13:48:58 +00:00
|
|
|
makes_footstep_sound = false,
|
2020-12-05 02:21:39 +00:00
|
|
|
fear_height = 0,
|
2017-07-05 01:15:46 +00:00
|
|
|
view_range = 16,
|
|
|
|
follow = mobs_mc.follow.parrot,
|
|
|
|
on_rightclick = function(self, clicker)
|
|
|
|
if self._doomed then return end
|
|
|
|
local item = clicker:get_wielded_item()
|
|
|
|
-- Kill parrot if fed with cookie
|
|
|
|
if item:get_name() == mobs_mc.items.cookie then
|
2020-12-05 22:37:12 +00:00
|
|
|
minetest.sound_play("mobs_mc_animal_eat_generic", {object = self.object, max_hear_distance=16}, true)
|
2017-07-05 01:15:46 +00:00
|
|
|
self.health = 0
|
|
|
|
-- Doomed to die
|
|
|
|
self._doomed = true
|
2020-07-10 14:08:40 +00:00
|
|
|
if not minetest.is_creative_enabled(clicker:get_player_name()) then
|
2017-07-05 01:15:46 +00:00
|
|
|
item:take_item()
|
|
|
|
clicker:set_wielded_item(item)
|
|
|
|
end
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Feed to tame, but not breed
|
|
|
|
if mobs:feed_tame(self, clicker, 1, false, true) then return end
|
|
|
|
end,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
2021-04-07 16:47:40 +00:00
|
|
|
-- Parrots spawn rarely in jungles. TODO: Also check for jungle *biome* <- I'll get to this eventually -j4i
|
2021-04-08 11:39:18 +00:00
|
|
|
mobs:spawn_specific(
|
|
|
|
"mobs_mc:parrot",
|
|
|
|
"overworld",
|
2021-04-08 12:12:43 +00:00
|
|
|
"ground",
|
2021-04-08 11:39:18 +00:00
|
|
|
{
|
|
|
|
"Jungle",
|
|
|
|
"JungleEdgeM",
|
|
|
|
"JungleM",
|
|
|
|
"JungleEdge",
|
|
|
|
},
|
|
|
|
0,
|
|
|
|
minetest.LIGHT_MAX+1,
|
|
|
|
7,
|
|
|
|
30000,
|
|
|
|
1,
|
|
|
|
mobs_mc.spawn_height.water+7,
|
|
|
|
mobs_mc.spawn_height.overworld_max)
|
2017-07-05 01:15:46 +00:00
|
|
|
|
|
|
|
-- spawn eggs
|
2020-12-05 13:45:10 +00:00
|
|
|
mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0)
|