90 lines
1.9 KiB
Lua
90 lines
1.9 KiB
Lua
|
|
guards = {}
|
|
|
|
local abs = math.abs
|
|
|
|
dofile(minetest.get_modpath("guards").."/formspec.lua");
|
|
dofile(minetest.get_modpath("guards").."/patrol.lua");
|
|
|
|
guards.on_spawn = function(self)
|
|
-- npcf-guard-specific data:
|
|
self.metadata = {
|
|
attack_players = "false",
|
|
patrol = "false",
|
|
patrol_points = {},
|
|
patrol_index = 0,
|
|
patrol_rest = 2,
|
|
show_armor = "true",
|
|
}
|
|
self.var = {
|
|
rest_timer = 0,
|
|
}
|
|
self.origin = {
|
|
pos = self.object:get_pos(),
|
|
yaw = self.object:get_yaw(),
|
|
}
|
|
return true
|
|
end
|
|
|
|
guards.guard_data = {
|
|
-- type needs to be "npc" - else it doesn't know how to follow
|
|
type = "npc", -- "guard",
|
|
passive = false, -- we are a guard...
|
|
damage = 9,
|
|
attack_type = "dogfight",
|
|
attacks_monsters = true,
|
|
attack_monsters = true,
|
|
attack_npcs = false,
|
|
attack_chance = 80,
|
|
owner_loyal = false,
|
|
pathfinding = false,
|
|
hp_min = 60,
|
|
hp_max = 100,
|
|
armor = 100,
|
|
collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3},
|
|
visual = "mesh",
|
|
visual_size = {x = 1, y = 1},
|
|
mesh = "skinsdb_3d_armor_character_5.b3d",
|
|
drawtype = "front",
|
|
textures = {{
|
|
"blank.png", -- cape?
|
|
-- "yl_speak_up_main_default.png", -- 64x64 skin
|
|
"2019_05_19_survivalist-dave-slim-13008091.png",
|
|
"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,
|
|
view_range = 32, -- search for hostile mobs!
|
|
owner = "Guard Guild",
|
|
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,
|
|
},
|
|
|
|
-- show the formspec
|
|
on_rightclick = guards.on_rightclick,
|
|
-- set up metadata
|
|
on_spawn = guards.on_spawn,
|
|
do_custom = guards.on_step,
|
|
}
|
|
|
|
mobs:register_mob("guards:guard", guards.guard_data)
|
|
mobs:register_egg("guards:guard", "Guard", "wool_grey.png", 1)
|