2021-05-23 08:11:37 -07:00
|
|
|
|
2021-05-23 21:18:55 -07:00
|
|
|
local S = core.get_translator(cmer_skeleton.modname)
|
|
|
|
|
|
|
|
|
2021-05-23 21:12:32 -07:00
|
|
|
local zombie_model = nil
|
2021-05-24 19:10:39 -07:00
|
|
|
local zombie_sounds = {}
|
2021-05-23 21:12:32 -07:00
|
|
|
local anim_walk = {start=102, stop=122, speed=15.5}
|
|
|
|
local anim_attack = {start=102, stop=122, speed=25}
|
|
|
|
|
|
|
|
if core.get_modpath("cmer_zombie") or core.get_modpath("zombie") then
|
|
|
|
zombie_model = "creatures_zombie.b3d"
|
2021-05-24 19:10:39 -07:00
|
|
|
zombie_sounds.on_death = {name="creatures_zombie_death", gain=0.7, distance=10}
|
2021-05-23 21:12:32 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
-- use player model if zombie not installed
|
|
|
|
if not zombie_model then
|
|
|
|
if not core.get_modpath("player_api") then
|
|
|
|
error("Compatible model not found (requires one of the following mods: \"cmer_zombie\", \"zombie\", \"player_api\")")
|
|
|
|
end
|
|
|
|
|
|
|
|
zombie_model = "character.b3d"
|
|
|
|
-- I don't know what the correct animations for default player model are
|
|
|
|
--anim_walk = {start=102, stop=122, speed=15.5}
|
|
|
|
--anim_attack = {start=102, stop=122, speed=25}
|
|
|
|
|
|
|
|
cmer_skeleton.log("warning", "using \"" .. zombie_model .. "\" model, may not look right")
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2021-05-24 19:05:13 -07:00
|
|
|
local mob_name = "creatures:skeleton"
|
|
|
|
|
2021-05-23 21:12:32 -07:00
|
|
|
creatures.register_mob({
|
2021-05-24 19:05:13 -07:00
|
|
|
name = ":" .. mob_name,
|
2021-05-24 19:05:38 -07:00
|
|
|
nametag = creatures.feature_nametags and S("Skeleton") or nil,
|
2021-05-23 08:12:41 -07:00
|
|
|
stats = {
|
|
|
|
hp = 55,
|
|
|
|
hostile = true,
|
|
|
|
lifetime = cmer_skeleton.lifetime,
|
|
|
|
can_jump = 1,
|
|
|
|
can_swim = true,
|
2021-05-24 21:08:48 -07:00
|
|
|
has_knockback = true,
|
2021-05-23 08:12:41 -07:00
|
|
|
},
|
|
|
|
modes = {
|
|
|
|
idle = {chance=0.3,},
|
|
|
|
walk = {chance=0.7, moving_speed=1,},
|
|
|
|
attack = {chance=0, moving_speed=3,},
|
|
|
|
},
|
|
|
|
model = {
|
2021-05-23 21:12:32 -07:00
|
|
|
mesh = zombie_model,
|
2021-05-23 08:12:41 -07:00
|
|
|
textures = {"cmer_skeleton_mesh.png"},
|
|
|
|
collisionbox = {-0.25, -0.01, -0.25, 0.25, 1.65, 0.25},
|
|
|
|
rotation = -90.0,
|
|
|
|
animations = {
|
|
|
|
idle = {start=0, stop=80, speed=15},
|
2021-05-23 21:12:32 -07:00
|
|
|
walk = anim_walk,
|
|
|
|
attack = anim_attack,
|
2021-05-23 08:12:41 -07:00
|
|
|
death = {start=81, stop=101, speed=28, loop=false, duration= 2.12},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
sounds = {
|
2021-05-24 19:10:39 -07:00
|
|
|
on_death = zombie_sounds.on_death,
|
2021-05-23 08:12:41 -07:00
|
|
|
random = {
|
|
|
|
idle = {name="cmer_skeleton_bones", gain=1.0,},
|
|
|
|
walk = {name="cmer_skeleton_bones", gain=1.0,},
|
|
|
|
attack = {name="cmer_skeleton_bones", gain=1.0,},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
drops = {
|
2021-06-01 20:41:40 -07:00
|
|
|
{"creatures:bone", 1, chance=1},
|
2021-05-23 08:12:41 -07:00
|
|
|
},
|
|
|
|
combat = {
|
|
|
|
attack_damage = 13,
|
|
|
|
attack_radius = 2.0,
|
|
|
|
search_enemy = true,
|
|
|
|
search_type = "player",
|
|
|
|
search_radius = 20,
|
|
|
|
},
|
|
|
|
spawning = {
|
|
|
|
abm_nodes = {
|
|
|
|
spawn_on = {
|
2021-05-31 09:41:21 -07:00
|
|
|
"group:sand",
|
|
|
|
"group:stone",
|
|
|
|
"nether:rack",
|
|
|
|
"nether:rack_deep",
|
2021-05-23 08:12:41 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
abm_interval = cmer_skeleton.spawn_interval,
|
|
|
|
abm_chance = cmer_skeleton.spawn_chance,
|
|
|
|
max_number = 1,
|
|
|
|
number = {min=1, max=2},
|
|
|
|
time_range = {min=0, max=23999},
|
|
|
|
light = {min=0, max=8},
|
|
|
|
height_limit = {min=-31000, max=31000},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2021-05-23 08:13:15 -07:00
|
|
|
if core.global_exists("asm") then
|
|
|
|
asm.addEgg({
|
|
|
|
name = "skeleton",
|
2021-05-23 21:18:55 -07:00
|
|
|
title = S("Skeleton"),
|
2021-05-23 08:13:15 -07:00
|
|
|
inventory_image = "cmer_skeleton_inv.png",
|
2021-05-24 19:05:13 -07:00
|
|
|
spawn = mob_name,
|
2021-05-31 09:41:47 -07:00
|
|
|
ingredients = "creatures:bone",
|
2021-05-23 08:13:15 -07:00
|
|
|
})
|
|
|
|
end
|
2021-05-24 19:06:02 -07:00
|
|
|
if not core.registered_items["creatures:skeleton"] then
|
|
|
|
core.register_alias("creatures:skeleton", "spawneggs:skeleton")
|
|
|
|
end
|
2021-05-23 08:13:15 -07:00
|
|
|
|
|
|
|
|
2021-05-31 09:41:47 -07:00
|
|
|
core.register_craftitem(":creatures:bone", {
|
2021-05-23 21:18:55 -07:00
|
|
|
description = S("Bone"),
|
2021-05-23 08:11:37 -07:00
|
|
|
inventory_image = "cmer_skeleton_bone.png",
|
2021-05-23 21:12:52 -07:00
|
|
|
stack_max = 99,
|
2021-05-23 08:11:37 -07:00
|
|
|
})
|
2021-06-01 20:41:40 -07:00
|
|
|
if not core.registered_items["cmer:bone"] then
|
2021-05-31 09:41:47 -07:00
|
|
|
core.register_alias("cmer:bone", "creatures:bone")
|
2021-05-24 19:06:02 -07:00
|
|
|
end
|