mod-skeleton/entity.lua

111 lines
2.6 KiB
Lua
Raw Normal View History

2021-05-23 08:11:37 -07:00
2021-05-23 21:18:55 -07:00
local S = core.get_translator(cmer_skeleton.modname)
local zombie_model = nil
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"
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"
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,
has_kockback = true,
},
modes = {
idle = {chance=0.3,},
walk = {chance=0.7, moving_speed=1,},
attack = {chance=0, moving_speed=3,},
},
model = {
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},
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 = {
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 = {
{"cmer:bone", 1, chance=1},
},
combat = {
attack_damage = 13,
attack_radius = 2.0,
search_enemy = true,
search_type = "player",
search_radius = 20,
},
spawning = {
abm_nodes = {
spawn_on = {
"default:sand",
"default:desert_sand",
"default:stone",
"default:desert_stone",
},
},
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-23 08:13:15 -07:00
ingredients = "cmer:bone",
})
end
2021-05-23 08:11:37 -07:00
core.register_craftitem(":cmer: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
})