npc_talk/example_npc.lua
2023-09-04 02:36:33 +02:00

72 lines
1.7 KiB
Lua

npc_talk.register_example_npc = function()
-- register the new mob
mobs:register_mob("npc_talk:npc", {
type = "npc",
passive = true,
damage = 9,
attack_type = "dogfight",
attacks_monsters = true,
attack_npcs = false,
owner_loyal = false,
pathfinding = false,
hp_min = 100,
hp_max = 100,
armor = 0,
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
visual = "mesh",
visual_size = {x = 1, y = 1},
-- TODO: mesh, textures
mesh = "skinsdb_3d_armor_character_5.b3d",
drawtype = "front",
textures = {{
"blank.png", -- cape?
"yl_speak_up_main_default.png", -- 64x64 skin
"3d_armor_trans.png", -- shield?!
"3d_armor_trans.png", -- item right hand
}},
makes_footstep_sound = true,
sounds = {},
walk_velocity = 2,
run_velocity = 3,
jump = false,
water_damage = 0,
lava_damage = 0,
light_damage = 0,
suffocation = 0,
view_range = 4,
owner = "Server",
order = "stand",
fear_height = 3,
animation = {
speed_normal = 30,
speed_run = 30,
stand_start = 0,
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 168,
run_end = 187,
punch_start = 200,
punch_end = 219,
},
on_rightclick = yl_speak_up.mobs_on_rightclick,
after_activate = yl_speak_up.mobs_after_activate
})
mobs:register_egg("npc_talk:npc", "NPC", "wool_blue.png", 1)
end
npc_talk.enable_talk_to_example_npc = function()
end
-- TODO: may require 3darmor?
if(minetest.get_modpath("mobs_npc")) then
-- register the NPC once
npc_talk.register_example_npc()
-- make sure it gets called once now and in the future whenever yl_speak_up is reloaded
-- (via /npc_talk_reload)
yl_speak_up.register_on_reload(npc_talk.enable_talk_to_example_npc, "npc_talk.enable_talk_to_example_npc()")
end