mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-04 23:31:05 +01:00
Add Spider Jockey
This commit is contained in:
parent
fec0dae4ca
commit
aa2693795d
5 changed files with 43 additions and 3 deletions
|
@ -467,6 +467,10 @@ local set_animation = function(self, anim, fixed_frame)
|
|||
return
|
||||
end
|
||||
|
||||
if self.jockey then
|
||||
anim = "jockey"
|
||||
end
|
||||
|
||||
if flight_check(self) and self.fly and anim == "walk" then anim = "fly" end
|
||||
|
||||
self._current_animation = self._current_animation or ""
|
||||
|
@ -3459,6 +3463,11 @@ end
|
|||
|
||||
local mob_detach_child = function(self, child)
|
||||
|
||||
if self.detach_child then
|
||||
if self.detach_child(self, child) then
|
||||
return
|
||||
end
|
||||
end
|
||||
if self.driver == child then
|
||||
self.driver = nil
|
||||
end
|
||||
|
@ -3807,6 +3816,9 @@ local mob_step = function(self, dtime)
|
|||
_locked_object_eye_height = self._locked_object:get_properties().eye_height
|
||||
end
|
||||
local self_rot = self.object:get_rotation()
|
||||
if self.object:get_attach() then
|
||||
self_rot = self.object:get_attach():get_rotation()
|
||||
end
|
||||
local player_pos = self._locked_object:get_pos()
|
||||
local direction_player = vector.direction(vector.add(self.object:get_pos(), vector.new(0, self.head_eye_height*.7, 0)), vector.add(player_pos, vector.new(0, _locked_object_eye_height, 0)))
|
||||
local mob_yaw = math.deg(-(-(self_rot.y)-(-minetest.dir_to_yaw(direction_player))))+self.head_yaw_offset
|
||||
|
@ -4094,6 +4106,7 @@ minetest.register_entity(name, {
|
|||
on_die = def.on_die,
|
||||
spawn_small_alternative = def.spawn_small_alternative,
|
||||
do_custom = def.do_custom,
|
||||
detach_child = def.detach_child,
|
||||
jump_height = def.jump_height or 4, -- was 6
|
||||
rotate = math.rad(def.rotate or 0), -- 0=front, 90=side, 180=back, 270=side2
|
||||
lifetimer = def.lifetimer or 57.73,
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -34,7 +34,6 @@ local skeleton = {
|
|||
"mcl_bows_bow_0.png", -- bow
|
||||
"mobs_mc_skeleton.png", -- skeleton
|
||||
} },
|
||||
visual_size = {x=1, y=1},
|
||||
makes_footstep_sound = true,
|
||||
textures = {
|
||||
{
|
||||
|
@ -81,11 +80,27 @@ local skeleton = {
|
|||
run_speed = 30,
|
||||
shoot_start = 70,
|
||||
shoot_end = 90,
|
||||
jockey_start = 172,
|
||||
jockey_end = 172,
|
||||
die_start = 160,
|
||||
die_end = 170,
|
||||
die_speed = 15,
|
||||
die_loop = false,
|
||||
},
|
||||
jock = "mobs_mc:spider",
|
||||
on_spawn = function(self)
|
||||
self.jockey = false
|
||||
if math.random(100) == 1 then -- 1% like from MCwiki
|
||||
self.jockey = true
|
||||
local jock = minetest.add_entity(self.object:get_pos(), "mobs_mc:spider")
|
||||
jock:get_luaentity().docile_by_day = false
|
||||
self.object:set_attach(jock, "", vector.new(0,0,0), vector.new(0,0,0))
|
||||
end
|
||||
return true
|
||||
end,
|
||||
on_detach=function(self, parent)
|
||||
self.jockey = false
|
||||
end,
|
||||
ignited_by_sunlight = true,
|
||||
view_range = 16,
|
||||
fear_height = 4,
|
||||
|
@ -93,6 +108,9 @@ local skeleton = {
|
|||
arrow = "mcl_bows:arrow_entity",
|
||||
shoot_arrow = function(self, pos, dir)
|
||||
if mod_bows then
|
||||
if self.attack then
|
||||
self.object:set_yaw(minetest.dir_to_yaw(vector.direction(self.object:get_pos(), self.attack:get_pos())))
|
||||
end
|
||||
-- 2-4 damage per arrow
|
||||
local dmg = math.max(4, math.random(2, 8))
|
||||
mcl_bows.shoot_arrow("mcl_bows:arrow", pos, dir, self.object:get_yaw(), self.object, nil, dmg)
|
||||
|
|
|
@ -14,7 +14,7 @@ local S = minetest.get_translator("mobs_mc")
|
|||
minetest.register_entity("mobs_mc:spider_eyes", {
|
||||
visual = "mesh",
|
||||
mesh = "mobs_mc_spider.b3d",
|
||||
visual_size = {x=1.01, y=1.01},
|
||||
visual_size = {x=1.01/3, y=1.01/3},
|
||||
textures = {
|
||||
"mobs_mc_spider_eyes.png",
|
||||
},
|
||||
|
@ -44,6 +44,7 @@ local spider = {
|
|||
xp_max = 5,
|
||||
armor = {fleshy = 100, arthropod = 100},
|
||||
on_spawn = function(self)
|
||||
self.object:set_properties({visual_size={x=1,y=1}})
|
||||
local spider_eyes=false
|
||||
for n = 1, #self.object:get_children() do
|
||||
local obj = self.object:get_children()[n]
|
||||
|
@ -55,6 +56,14 @@ local spider = {
|
|||
minetest.add_entity(self.object:get_pos(), "mobs_mc:spider_eyes"):set_attach(self.object, "body.head", vector.new(0,-0.98,2), vector.new(90,180,180))
|
||||
end
|
||||
end,
|
||||
on_die=function(self)
|
||||
if self.object:get_children() and self.object:get_children()[1] then
|
||||
self.object:get_children()[1]:set_detach()
|
||||
end
|
||||
end,
|
||||
detach_child=function(self, child)
|
||||
child:get_luaentity().jockey = false
|
||||
end,
|
||||
head_swivel = "Head_Control",
|
||||
bone_eye_height = 1,
|
||||
curiosity = 10,
|
||||
|
@ -65,7 +74,7 @@ local spider = {
|
|||
textures = {
|
||||
{"mobs_mc_spider.png"},
|
||||
},
|
||||
visual_size = {x=3, y=3},
|
||||
visual_size = {x=1, y=1},
|
||||
makes_footstep_sound = false,
|
||||
sounds = {
|
||||
random = "mobs_mc_spider_random",
|
||||
|
|
Loading…
Reference in a new issue