star_wars/mods/mobs_monster/tusken_raider.lua

124 lines
2.5 KiB
Lua
Raw Normal View History

2019-12-18 16:46:58 +01:00
local S = mobs.intllib
-- custom particle effects
local effect = function(pos, amount, texture, min_size, max_size, radius, gravity, glow)
radius = radius or 2
min_size = min_size or 0.5
max_size = max_size or 1
gravity = gravity or -10
glow = glow or 0
minetest.add_particlespawner({
amount = amount,
time = 0.25,
minpos = pos,
maxpos = pos,
minvel = {x = -radius, y = -radius, z = -radius},
maxvel = {x = radius, y = radius, z = radius},
minacc = {x = 0, y = gravity, z = 0},
maxacc = {x = -20, y = gravity, z = 15},
minexptime = 0.1,
maxexptime = 1,
minsize = min_size,
maxsize = max_size,
texture = texture,
glow = glow,
})
end
-- Sand Monster by PilzAdam
mobs:register_mob("mobs_monster:tusken_raider", {
2019-12-18 16:46:58 +01:00
type = "monster",
passive = false,
attack_type = "dogfight",
pathfinding = true,
--specific_attack = {"player", "mobs_npc:npc"},
reach = 2,
damage = 1,
hp_min = 4,
hp_max = 20,
armor = 100,
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",
2019-12-18 17:33:17 +01:00
mesh = "mobs_character.b3d",
2019-12-18 16:46:58 +01:00
textures = {
2019-12-18 17:33:17 +01:00
{"mobs_tusken_raider.png"},
2019-12-18 16:46:58 +01:00
},
blood_texture = "default_desert_sand.png",
makes_footstep_sound = true,
sounds = {
random = "mobs_sandmonster",
},
walk_velocity = 1.5,
run_velocity = 4,
view_range = 8, --15
jump = true,
floats = 0,
drops = {
{name = "default:desert_sand", chance = 1, min = 3, max = 5},
},
water_damage = 3,
lava_damage = 4,
light_damage = 0,
fear_height = 4,
animation = {
2019-12-18 21:31:24 +01:00
speed_normal = 30,
speed_run = 30,
2019-12-18 16:46:58 +01:00
stand_start = 0,
2019-12-18 21:31:24 +01:00
stand_end = 79,
walk_start = 168,
walk_end = 187,
run_start = 168,
run_end = 187,
punch_start = 200,
punch_end = 219,
2019-12-18 16:46:58 +01:00
},
--[[
custom_attack = function(self, p)
local pos = self.object:get_pos()
minetest.add_item(pos, "default:sand")
end,
]]
on_die = function(self, pos)
pos.y = pos.y + 0.5
effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
pos.y = pos.y + 0.25
effect(pos, 30, "mobs_sand_particles.png", 0.1, 2, 3, 5)
end,
--[[
on_rightclick = function(self, clicker)
local tool = clicker:get_wielded_item()
local name = clicker:get_player_name()
if tool:get_name() == "default:sand" then
self.owner = name
self.type = "npc"
mobs:force_capture(self, clicker)
end
end,
]]
})
mobs:spawn({
name = "mobs_monster:tusken_raider",
2019-12-18 16:46:58 +01:00
nodes = {"default:desert_sand"},
chance = 7000,
active_object_count = 2,
min_height = 0,
})
mobs:register_egg("mobs_monster:tusken_raider", S("Tusken Raider"), "default_desert_sand.png", 1)
2019-12-18 16:46:58 +01:00
mobs:alias_mob("mobs:tusken_raider", "mobs_monster:tusken_raider") -- compatibility