Update mobs_mc, properly implement totem
[MineClone/MineClone2.git] / mods / ENTITIES / mobs_mc / parrot.lua
blobef421557b2e9aca2f2c12157f940b8c57a754d20
1 --MCmobs v0.4
2 --maikerumine
3 --made for MC like Survival game
4 --License for code WTFPL and otherwise stated in readmes
6 -- intllib
7 local MP = minetest.get_modpath(minetest.get_current_modname())
8 local S, NS = dofile(MP.."/intllib.lua")
10 --dofile(minetest.get_modpath("mobs").."/api.lua")
13 --###################
14 --################### PARROT
15 --###################
19 mobs:register_mob("mobs_mc:parrot", {
20 type = "npc",
21 pathfinding = 1,
22 hp_min = 6,
23 hp_max = 6,
24 collisionbox = {-0.25, -0.01, -0.25, 0.25, 0.89, 0.25},
25 visual = "mesh",
26 mesh = "mobs_mc_parrot.b3d",
27 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"}},
28 visual_size = {x=3, y=3},
29 makes_footstep_sound = true,
30 walk_velocity = 3,
31 run_velocity = 5,
32 drops = {
33 {name = mobs_mc.items.feather,
34 chance = 1,
35 min = 1,
36 max = 2,},
38 animation = {
39 stand_speed = 50,
40 walk_speed = 50,
41 stand_start = 0,
42 stand_end = 0,
43 walk_start = 0,
44 walk_end = 130,
45 --run_start = 0,
46 --run_end = 20,
47 --fly_start = 30,
48 --fly_end = 45,
50 walk_chance = 100,
51 water_damage = 0,
52 lava_damage = 4,
53 light_damage = 0,
54 fall_damage = 0,
55 fall_speed = -2.25,
56 attack_type = "dogfight",
57 jump = true,
58 jump_height = 4,
59 floats = 1,
60 physical = true,
61 fly = true,
62 fly_in = {"air"},
63 fear_height = 4,
64 view_range = 16,
65 follow = mobs_mc.follow.parrot,
66 on_rightclick = function(self, clicker)
67 if self._doomed then return end
68 local item = clicker:get_wielded_item()
69 -- Kill parrot if fed with cookie
70 if item:get_name() == mobs_mc.items.cookie then
71 self.health = 0
72 -- Doomed to die
73 self._doomed = true
74 if not minetest.settings:get_bool("creative_mode") then
75 item:take_item()
76 clicker:set_wielded_item(item)
77 end
78 return
79 end
81 -- Feed to tame, but not breed
82 if mobs:feed_tame(self, clicker, 1, false, true) then return end
83 if mobs:protect(self, clicker) then return end
84 if mobs:capture_mob(self, clicker, 0, 50, 80, false, nil) then return end
85 end,
90 -- Spawn disabled because parrots are not very smart.
91 -- TODO: Re-enable when parrots are finished
92 --mobs:spawn_specific("mobs_mc:parrot", mobs_mc.spawn.jungle, {"air"}, 0, minetest.LIGHT_MAX+1, 30, 30000, 1, mobs_mc.spawn_height.water+1, mobs_mc.spawn_height.overworld_max)
94 -- spawn eggs
95 mobs:register_egg("mobs_mc:parrot", S("Parrot"), "mobs_mc_spawn_icon_parrot.png", 0)
97 if minetest.settings:get_bool("log_mods") then
98 minetest.log("action", "MC Parrot loaded")
99 end