Make villager stand still if there is near player
[MineClone/MineClone2.git] / mods / ENTITIES / mobs_mc / skeleton+stray.lua
blobdec089070ed30038d98be9784cd33ce0af9cc8ef
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 = "skeleton1",
36 death = "skeletondeath",
37 damage = "skeletonhurt1",
38 distance = 16,
40 walk_velocity = 1.2,
41 run_velocity = 2.4,
42 damage = 2,
43 reach = 2,
44 drops = {
45 {name = mobs_mc.items.arrow,
46 chance = 1,
47 min = 0,
48 max = 2,},
49 {name = mobs_mc.items.bow,
50 chance = 11,
51 min = 1,
52 max = 1,},
53 {name = mobs_mc.items.bone,
54 chance = 1,
55 min = 0,
56 max = 2,},
58 -- Head
59 -- TODO: Only drop if killed by charged creeper
60 {name = mobs_mc.items.head_skeleton,
61 chance = 200, -- 0.5% chance
62 min = 1,
63 max = 1,},
65 animation = {
66 stand_speed = 15,
67 stand_start = 0,
68 stand_end = 40,
69 walk_speed = 15,
70 walk_start = 40,
71 walk_end = 60,
72 run_speed = 30,
73 shoot_start = 70,
74 shoot_end = 90,
75 die_start = 160,
76 die_end = 170,
77 die_speed = 15,
78 die_loop = false,
80 water_damage = 1,
81 lava_damage = 4,
82 sunlight_damage = 1,
83 view_range = 16,
84 fear_height = 4,
85 attack_type = "dogshoot",
86 arrow = "mobs_mc:arrow_entity",
87 shoot_interval = 2.5,
88 shoot_offset = 1,
89 dogshoot_switch = 1,
90 dogshoot_count_max =1.8,
91 blood_amount = 0,
94 mobs:register_mob("mobs_mc:skeleton", skeleton)
97 --###################
98 --################### STRAY
99 --###################
101 local stray = table.copy(skeleton)
102 stray.mesh = "mobs_mc_stray.b3d"
103 stray.textures = {
105 "mcl_bows_bow_0.png",
106 "mobs_mc_stray.png",
107 "mobs_mc_stray_overlay.png",
110 -- TODO: different sound (w/ echo)
111 -- TODO: stray's arrow inflicts slowness status
112 table.insert(stray.drops, {
113 -- Chance to drop additional arrow.
114 -- TODO: Should be tipped arrow of slowness
115 name = mobs_mc.items.arrow,
116 chance = 2,
117 min = 1,
118 max = 1,
121 mobs:register_mob("mobs_mc:stray", stray)
123 -- compatibility
124 mobs:alias_mob("mobs:skeleton", "mobs_mc:skeleton")
126 -- Overworld spawn
127 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)
128 -- Nether spawn
129 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)
131 -- Stray spawn
132 -- TODO: Spawn directly under the sky
133 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)
136 -- spawn eggs
137 mobs:register_egg("mobs_mc:skeleton", S("Skeleton"), "mobs_mc_spawn_icon_skeleton.png", 0)
138 mobs:register_egg("mobs_mc:stray", S("Stray"), "mobs_mc_spawn_icon_stray.png", 0)
140 if minetest.settings:get_bool("log_mods") then
141 minetest.log("action", "MC Skeleton loaded")