Add bow shooting sound when mob fires an arrow
[MineClone/MineClone2.git] / mods / ENTITIES / mobs_mc / skeleton+stray.lua
bloba10fef5ecffd96357ba23d16e3b35d0898fba863
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 --################### SKELETON
15 --###################
19 local skeleton = {
20 type = "monster",
21 hp_min = 20,
22 hp_max = 20,
23 collisionbox = {-0.3, -0.01, -0.3, 0.3, 1.98, 0.3},
24 pathfinding = 1,
25 group_attack = true,
26 visual = "mesh",
27 mesh = "mobs_mc_skeleton.b3d",
28 textures = { {
29 "mcl_bows_bow_0.png", -- bow
30 "mobs_mc_skeleton.png", -- skeleton
31 } },
32 visual_size = {x=3, y=3},
33 makes_footstep_sound = true,
34 sounds = {
35 random = "mobs_mc_skeleton_random",
36 death = "mobs_mc_skeleton_death",
37 damage = "mobs_mc_skeleton_hurt",
38 shoot_attack = "mcl_bows_bow_shoot",
39 distance = 16,
41 walk_velocity = 1.2,
42 run_velocity = 2.4,
43 damage = 2,
44 reach = 2,
45 drops = {
46 {name = mobs_mc.items.arrow,
47 chance = 1,
48 min = 0,
49 max = 2,},
50 {name = mobs_mc.items.bow,
51 chance = 11,
52 min = 1,
53 max = 1,},
54 {name = mobs_mc.items.bone,
55 chance = 1,
56 min = 0,
57 max = 2,},
59 -- Head
60 -- TODO: Only drop if killed by charged creeper
61 {name = mobs_mc.items.head_skeleton,
62 chance = 200, -- 0.5% chance
63 min = 1,
64 max = 1,},
66 animation = {
67 stand_speed = 15,
68 stand_start = 0,
69 stand_end = 40,
70 walk_speed = 15,
71 walk_start = 40,
72 walk_end = 60,
73 run_speed = 30,
74 shoot_start = 70,
75 shoot_end = 90,
76 die_start = 160,
77 die_end = 170,
78 die_speed = 15,
79 die_loop = false,
81 water_damage = 1,
82 lava_damage = 4,
83 sunlight_damage = 1,
84 view_range = 16,
85 fear_height = 4,
86 attack_type = "dogshoot",
87 arrow = "mobs_mc:arrow_entity",
88 shoot_interval = 2.5,
89 shoot_offset = 1,
90 dogshoot_switch = 1,
91 dogshoot_count_max =1.8,
92 blood_amount = 0,
95 mobs:register_mob("mobs_mc:skeleton", skeleton)
98 --###################
99 --################### STRAY
100 --###################
102 local stray = table.copy(skeleton)
103 stray.mesh = "mobs_mc_stray.b3d"
104 stray.textures = {
106 "mcl_bows_bow_0.png",
107 "mobs_mc_stray.png",
108 "mobs_mc_stray_overlay.png",
111 -- TODO: different sound (w/ echo)
112 -- TODO: stray's arrow inflicts slowness status
113 table.insert(stray.drops, {
114 -- Chance to drop additional arrow.
115 -- TODO: Should be tipped arrow of slowness
116 name = mobs_mc.items.arrow,
117 chance = 2,
118 min = 1,
119 max = 1,
122 mobs:register_mob("mobs_mc:stray", stray)
124 -- compatibility
125 mobs:alias_mob("mobs:skeleton", "mobs_mc:skeleton")
127 -- Overworld spawn
128 mobs:spawn_specific("mobs_mc:skeleton", mobs_mc.spawn.solid, {"air"}, 0, 7, 20, 17000, 2, mobs_mc.spawn_height.overworld_min, mobs_mc.spawn_height.overworld_max)
129 -- Nether spawn
130 mobs:spawn_specific("mobs_mc:skeleton", mobs_mc.spawn.nether_fortress, {"air"}, 0, 7, 30, 10000, 3, mobs_mc.spawn_height.nether_min, mobs_mc.spawn_height.nether_max)
132 -- Stray spawn
133 -- TODO: Spawn directly under the sky
134 mobs:spawn_specific("mobs_mc:stray", mobs_mc.spawn.snow, {"air"}, 0, 7, 20, 19000, 2, mobs_mc.spawn_height.water, mobs_mc.spawn_height.overworld_max)
137 -- spawn eggs
138 mobs:register_egg("mobs_mc:skeleton", S("Skeleton"), "mobs_mc_spawn_icon_skeleton.png", 0)
139 mobs:register_egg("mobs_mc:stray", S("Stray"), "mobs_mc_spawn_icon_stray.png", 0)
141 if minetest.settings:get_bool("log_mods") then
142 minetest.log("action", "MC Skeleton loaded")