ma_mobs/mobs/assaultsuit.lua
Vitaliy olkhin 5854d64b5b init
2025-01-29 12:31:02 +05:00

159 lines
5.7 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local S = minetest.get_translator("ma_mobs")
mobs:register_mob("ma_mobs:assaultsuit", {
--type = "npc",
type = "monster",
visual = "mesh",
visual_size = {x = 1.20, y = 1.20},
mesh = "assaultsuit.b3d",
collisionbox = {-0.5, -0.01, -1.4, 1.4, 5.25, 1.4},
animation = {
speed_normal = 15,
speed_run = 30,
stand_start = 25,
stand_end = 75,
walk_start = 0,
walk_end = 50,
run_start = 75,
run_end = 100,
},
sounds = {
--random = "ma_mobs_assaultsuit",
shoot_attack = "mobs_fireball"
},
blood_amount = 0, -- int Количество капель крови, появляющихся при попадании.
textures = {
{"vehicles_assaultsuit.png"},
},
fear_height = 3,
runaway = false, --bool Если true , моб отступит при ударе.
fly = false,
walk_chance = 60,
jump = true,
jump_height = 8,
passive = false, --логический Моб не будет защищать себя (установите значение false для атаки).
attack_type = "dogshoot", --Если attack_type — «shoot» или «dogshoot» , то требуется имя сущности предопределенной стрелы (см. mobs:register_arrow ).
arrow = "ma_mobs:missile",
group_attack = true, --bool Если true , будет защищать находящихся поблизости мобов того же типа от атак.
pathfinding = true,
view_range = 40, --int Расстояние, на котором моб будет следовать за игроком или другими существами или атаковать их.
damage = 10, --Урон, наносимый мобом за каждую атаку в ближнем бою.
recovery_time = 1.0, --Сколько времени в секундах проходит с момента удара моба до его восстановления. По умолчанию: 0,5
--follow = {"farming:wheat"},
shoot_interval = 2, --Минимальный интервал съемки.
hp_min = 100,
hp_max = 200,
armor = 30,
lava_damage = 0,
fall_damage = 0,
water_damage = 0,
makes_footstep_sound = true,
attacks_monsters = true,
attack_animals = true, --bool Если true , будет атаковать животных, а также игроков и NPC.
reach = 3, --Range at which mob will shoot (default: 3).
drops = {
{name = "vehicles:assaultsuit_spawner", chance = 1, min = 1, max = 1}
},
--[[do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
-- elf.v2 = 0
self.max_speed_forward = 6
self.max_speed_reverse = 2
self.accel = 6
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 20, z = -2}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_scale = {x = 1, y = 1}
end
-- if driver present allow control of horse
if self.driver then
mobs.drive(self, "walk", "stand", false, dtime)
return false -- skip rest of mob functions
end
return true
end,]]
on_die = function(self, pos)
-- drop saddle when horse is killed while riding
-- also detach from horse properly
if self.driver then
--minetest.add_item(pos, "mobs:saddle")
--mobs.detach(self.driver, {x = 1, y = 0, z = 1})
end
end,
})
mobs:register_arrow("ma_mobs:missile", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"vehicles_missile_inv.png"},
collisionbox = {-0.1, -0.1, -0.1, 0.1, 0.1, 0.1},
velocity = 30,
tail = 1,
tail_texture = "vehicles_missile_inv.png",
tail_size = 10,
glow = 5,
expire = 0.1,
on_activate = function(self, staticdata, dtime_s)
-- make fireball indestructable
self.object:set_armor_groups({immortal = 1, fleshy = 100})
end,
-- if player has a good weapon with 7+ damage it can deflect fireball
on_punch = function(self, hitter, tflp, tool_capabilities, dir)
if hitter and hitter:is_player() and tool_capabilities and dir then
local damage = tool_capabilities.damage_groups and
tool_capabilities.damage_groups.fleshy or 1
local tmp = tflp / (tool_capabilities.full_punch_interval or 1.4)
if damage > 6 and tmp < 4 then
self.object:set_velocity({
x = dir.x * self.velocity,
y = dir.y * self.velocity,
z = dir.z * self.velocity
})
end
end
end,
-- direct hit, no fire... just plenty of pain
hit_player = function(self, player)
--mobs:boom(self, self.lastpos, 2)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8}
}, nil)
end,
hit_mob = function(self, player)
--mobs:boom(self, self.lastpos, 2)
player:punch(self.object, 1.0, {
full_punch_interval = 1.0,
damage_groups = {fleshy = 8}
}, nil)
end,
-- node hit
hit_node = function(self, pos, node)
mobs:boom(self, pos, 2)
end
})
mobs:register_egg("ma_mobs:assaultsuit", S("Assaultsuit"), "ma_mobs_assaultsuit_inv.png", 1)
if ma_mobs.settings.spawn == true then
mobs:spawn({
name = "ma_mobs:assaultsuit",
nodes = {"ethereal:dry_dirt"},
--chance = 150000,
chance = 1500,
active_object_count = 1,
})
end