forked from VoxeLibre/VoxeLibre
Compare commits
21 Commits
master
...
mobs_head_
Author | SHA1 | Date |
---|---|---|
epCode | e5ff73af3a | |
epCode | d0d7facfd7 | |
epCode | 65b0908135 | |
epCode | 7d68c4faf3 | |
epCode | 7eee604074 | |
epCode | e5a090168f | |
epCode | 7e14870e38 | |
epCode | daa8a5c3ea | |
epCode | 2909de882a | |
epCode | 1d4046beea | |
epCode | cbb4c93e0c | |
epCode | 761cb8b366 | |
epCode | 9ece73a92f | |
epCode | b991bb5291 | |
epCode | 36ddec9812 | |
epCode | a2a06cc3ee | |
epCode | 6c804f44d5 | |
epCode | 78940e109c | |
epCode | fdb7d5bfad | |
epCode | f2c2f4106b | |
epCode | e1feec9a30 |
|
@ -125,6 +125,14 @@ local disable_physics = function(object, luaentity, ignore_check, reset_movement
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function dir_to_pitch(dir)
|
||||||
|
--local dir2 = vector.normalize(dir)
|
||||||
|
local xz = math.abs(dir.x) + math.abs(dir.z)
|
||||||
|
return -math.atan2(-dir.y, xz)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- play sound
|
-- play sound
|
||||||
local mob_sound = function(self, soundname, is_opinion, fixed_pitch)
|
local mob_sound = function(self, soundname, is_opinion, fixed_pitch)
|
||||||
|
|
||||||
|
@ -3645,6 +3653,60 @@ local mob_step = function(self, dtime)
|
||||||
|
|
||||||
-- end rotation
|
-- end rotation
|
||||||
|
|
||||||
|
if self.head_swivel and type(self.head_swivel) == "string" then
|
||||||
|
local oldp,oldr = self.object:get_bone_position(self.head_swivel)
|
||||||
|
|
||||||
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 10)) do
|
||||||
|
if obj:is_player() and not self.attack then
|
||||||
|
if not self._locked_object then
|
||||||
|
if math.random(50/self.curiosity) == 1 then
|
||||||
|
self._locked_object = obj
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if math.random(200*self.curiosity) == 1 then
|
||||||
|
self._locked_object = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.attack then
|
||||||
|
self._locked_object = self.attack
|
||||||
|
end
|
||||||
|
|
||||||
|
if self._locked_object and (self._locked_object:is_player() or self._locked_object:get_luaentity()) and self._locked_object:get_hp() > 0 then
|
||||||
|
local _locked_object_eye_height = 1.5
|
||||||
|
if self._locked_object:is_player() then
|
||||||
|
_locked_object_eye_height = self._locked_object:get_properties().eye_height
|
||||||
|
end
|
||||||
|
local self_rot = self.object:get_rotation()
|
||||||
|
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
|
||||||
|
local mob_pitch = math.deg(-dir_to_pitch(direction_player))
|
||||||
|
if (mob_yaw < -60 or mob_yaw > 60) and not (self.attack and self.type == "monster") then
|
||||||
|
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.multiply(oldr, 0.9))
|
||||||
|
elseif self.attack and self.type == "monster" then
|
||||||
|
if self.head_yaw == "y" then
|
||||||
|
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.new(mob_pitch, mob_yaw, 0))
|
||||||
|
elseif self.head_yaw == "z" then
|
||||||
|
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.new(mob_pitch, 0, -mob_yaw))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if self.head_yaw == "y" then
|
||||||
|
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, ((mob_yaw-oldr.y)*.3)+oldr.y, 0))
|
||||||
|
elseif self.head_yaw == "z" then
|
||||||
|
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.new(((mob_pitch-oldr.x)*.3)+oldr.x, 0, -(((mob_yaw-oldr.y)*.3)+oldr.y)*3))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif not self._locked_object and math.abs(oldr.y) > 3 and math.abs(oldr.x) < 3 then
|
||||||
|
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.multiply(oldr, 0.9))
|
||||||
|
else
|
||||||
|
self.object:set_bone_position(self.head_swivel, vector.new(0,self.bone_eye_height,self.horrizonatal_head_height), vector.new(0,0,0))
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- run custom function (defined in mob lua file)
|
-- run custom function (defined in mob lua file)
|
||||||
if self.do_custom then
|
if self.do_custom then
|
||||||
|
|
||||||
|
@ -3884,6 +3946,13 @@ end
|
||||||
minetest.register_entity(name, {
|
minetest.register_entity(name, {
|
||||||
|
|
||||||
use_texture_alpha = def.use_texture_alpha,
|
use_texture_alpha = def.use_texture_alpha,
|
||||||
|
head_swivel = def.head_swivel or nil, -- name of head bone
|
||||||
|
head_yaw_offset = def.head_yaw_offset or 0, -- name of head bone
|
||||||
|
bone_eye_height = def.bone_eye_height or 1.4, -- mob eye height
|
||||||
|
head_eye_height = def.head_eye_height or def.bone_eye_height or 0, -- factor for staqring at players
|
||||||
|
curiosity = def.curiosity or 1, -- factor for staqring at players
|
||||||
|
head_yaw = def.head_yaw or "y", -- factor for staqring at players
|
||||||
|
horrizonatal_head_height = def.horrizonatal_head_height or 0, -- factor for staqring at players
|
||||||
stepheight = def.stepheight or 0.6,
|
stepheight = def.stepheight or 0.6,
|
||||||
name = name,
|
name = name,
|
||||||
description = def.description,
|
description = def.description,
|
||||||
|
|
|
@ -25,6 +25,13 @@ mcl_mobs:register_mob("mobs_mc:chicken", {
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_mc_chicken.png"},
|
{"mobs_mc_chicken.png"},
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 1.8,
|
||||||
|
head_eye_height = 1.5,
|
||||||
|
curiosity = 10,
|
||||||
|
head_yaw="z",
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=2.2, y=2.2},
|
visual_size = {x=2.2, y=2.2},
|
||||||
|
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
|
|
|
@ -17,6 +17,14 @@ local cow_def = {
|
||||||
"mobs_mc_cow.png",
|
"mobs_mc_cow.png",
|
||||||
"blank.png",
|
"blank.png",
|
||||||
}, },
|
}, },
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 3.4,
|
||||||
|
head_eye_height = 1.1,
|
||||||
|
horrizonatal_head_height=-.7,
|
||||||
|
curiosity = 2,
|
||||||
|
head_yaw="z",
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=2.8, y=2.8},
|
visual_size = {x=2.8, y=2.8},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
walk_velocity = 1,
|
walk_velocity = 1,
|
||||||
|
|
|
@ -24,6 +24,11 @@ mcl_mobs:register_mob("mobs_mc:creeper", {
|
||||||
{"mobs_mc_creeper.png",
|
{"mobs_mc_creeper.png",
|
||||||
"mobs_mc_empty.png"},
|
"mobs_mc_empty.png"},
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 2.35,
|
||||||
|
curiosity = 2,
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
sounds = {
|
sounds = {
|
||||||
attack = "tnt_ignite",
|
attack = "tnt_ignite",
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -15,10 +15,19 @@ mcl_mobs:register_mob("mobs_mc:pig", {
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_pig.b3d",
|
mesh = "mobs_mc_pig.b3d",
|
||||||
textures = {{
|
textures = {{
|
||||||
"blank.png", -- baby
|
|
||||||
"mobs_mc_pig.png", -- base
|
|
||||||
"blank.png", -- saddle
|
"blank.png", -- saddle
|
||||||
|
"mobs_mc_pig.png", -- base
|
||||||
|
"blank.png",
|
||||||
}},
|
}},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 2.9,
|
||||||
|
head_eye_height = 0.8,
|
||||||
|
horrizonatal_head_height=-.4,
|
||||||
|
curiosity = 3,
|
||||||
|
head_yaw="z",
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
visual_size = {x=2.5, y=2.5},
|
visual_size = {x=2.5, y=2.5},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
walk_velocity = 1,
|
walk_velocity = 1,
|
||||||
|
@ -111,9 +120,9 @@ mcl_mobs:register_mob("mobs_mc:pig", {
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
if item:get_name() == "mcl_mobitems:saddle" and self.saddle ~= "yes" then
|
if item:get_name() == "mcl_mobitems:saddle" and self.saddle ~= "yes" then
|
||||||
self.base_texture = {
|
self.base_texture = {
|
||||||
"blank.png", -- baby
|
|
||||||
"mobs_mc_pig.png", -- base
|
|
||||||
"mobs_mc_pig_saddle.png", -- saddle
|
"mobs_mc_pig_saddle.png", -- saddle
|
||||||
|
"mobs_mc_pig.png", -- base
|
||||||
|
"blank.png", -- baby
|
||||||
}
|
}
|
||||||
self.object:set_properties({
|
self.object:set_properties({
|
||||||
textures = self.base_texture
|
textures = self.base_texture
|
||||||
|
|
|
@ -61,7 +61,14 @@ mcl_mobs:register_mob("mobs_mc:sheep", {
|
||||||
xp_min = 1,
|
xp_min = 1,
|
||||||
xp_max = 3,
|
xp_max = 3,
|
||||||
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.29, 0.45},
|
collisionbox = {-0.45, -0.01, -0.45, 0.45, 1.29, 0.45},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 3.3,
|
||||||
|
head_eye_height = 1.1,
|
||||||
|
horrizonatal_head_height=-.7,
|
||||||
|
curiosity = 6,
|
||||||
|
head_yaw="z",
|
||||||
|
-------------------------------
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
mesh = "mobs_mc_sheepfur.b3d",
|
mesh = "mobs_mc_sheepfur.b3d",
|
||||||
|
|
|
@ -31,6 +31,11 @@ local skeleton = {
|
||||||
"mcl_bows_bow_0.png", -- bow
|
"mcl_bows_bow_0.png", -- bow
|
||||||
"mobs_mc_skeleton.png", -- skeleton
|
"mobs_mc_skeleton.png", -- skeleton
|
||||||
} },
|
} },
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 2.35,
|
||||||
|
curiosity = .1,
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=1, y=1},
|
visual_size = {x=1, y=1},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
textures = {
|
textures = {
|
||||||
|
|
|
@ -33,6 +33,12 @@ local spider = {
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_mc_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"},
|
{"mobs_mc_spider.png^(mobs_mc_spider_eyes.png^[makealpha:0,0,0)"},
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 1,
|
||||||
|
curiosity = 10,
|
||||||
|
head_yaw="z",
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
makes_footstep_sound = false,
|
makes_footstep_sound = false,
|
||||||
sounds = {
|
sounds = {
|
||||||
|
|
|
@ -1218,6 +1218,11 @@ mcl_mobs:register_mob("mobs_mc:villager", {
|
||||||
"mobs_mc_villager.png",
|
"mobs_mc_villager.png",
|
||||||
"mobs_mc_villager.png", --hat
|
"mobs_mc_villager.png", --hat
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 2.35,
|
||||||
|
curiosity = 10,
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=2.75, y=2.75},
|
visual_size = {x=2.75, y=2.75},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
walk_velocity = 1.2,
|
walk_velocity = 1.2,
|
||||||
|
|
|
@ -39,13 +39,18 @@ mcl_mobs:register_mob("mobs_mc:villager_zombie", {
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_villager_zombie.b3d",
|
mesh = "mobs_mc_villager_zombie.b3d",
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_mc_empty.png", "mobs_mc_zombie_butcher.png", "mobs_mc_empty.png"},
|
{"mobs_mc_zombie_butcher.png"},
|
||||||
{"mobs_mc_empty.png", "mobs_mc_zombie_farmer.png", "mobs_mc_empty.png"},
|
{"mobs_mc_zombie_farmer.png"},
|
||||||
{"mobs_mc_empty.png", "mobs_mc_zombie_librarian.png", "mobs_mc_empty.png"},
|
{"mobs_mc_zombie_librarian.png"},
|
||||||
{"mobs_mc_empty.png", "mobs_mc_zombie_priest.png", "mobs_mc_empty.png"},
|
{"mobs_mc_zombie_priest.png"},
|
||||||
{"mobs_mc_empty.png", "mobs_mc_zombie_smith.png", "mobs_mc_empty.png"},
|
{"mobs_mc_zombie_smith.png"},
|
||||||
{"mobs_mc_empty.png", "mobs_mc_zombie_villager.png", "mobs_mc_empty.png"},
|
{"mobs_mc_zombie_villager.png"},
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 2.35,
|
||||||
|
curiosity = 2,
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=2.75, y=2.75},
|
visual_size = {x=2.75, y=2.75},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
damage = 3,
|
damage = 3,
|
||||||
|
|
|
@ -25,6 +25,12 @@ mcl_mobs:register_mob("mobs_mc:wither", {
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_mc_wither.png"},
|
{"mobs_mc_wither.png"},
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 0.43,
|
||||||
|
head_eye_height = 3,
|
||||||
|
curiosity = 2,
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=4, y=4},
|
visual_size = {x=4, y=4},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
view_range = 16,
|
view_range = 16,
|
||||||
|
|
|
@ -24,6 +24,14 @@ local wolf = {
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_mc_wolf.png"},
|
{"mobs_mc_wolf.png"},
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 1.2,
|
||||||
|
head_eye_height = 1.1,
|
||||||
|
horrizonatal_head_height=0,
|
||||||
|
curiosity = 10,
|
||||||
|
head_yaw="z",
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
sounds = {
|
sounds = {
|
||||||
|
@ -73,7 +81,7 @@ local wolf = {
|
||||||
end,
|
end,
|
||||||
animation = {
|
animation = {
|
||||||
speed_normal = 50, speed_run = 100,
|
speed_normal = 50, speed_run = 100,
|
||||||
stand_start = 40, stand_end = 45,
|
stand_start = 1, stand_end = 1,
|
||||||
walk_start = 0, walk_end = 40,
|
walk_start = 0, walk_end = 40,
|
||||||
run_start = 0, run_end = 40,
|
run_start = 0, run_end = 40,
|
||||||
},
|
},
|
||||||
|
|
|
@ -60,11 +60,16 @@ local zombie = {
|
||||||
mesh = "mobs_mc_zombie.b3d",
|
mesh = "mobs_mc_zombie.b3d",
|
||||||
textures = {
|
textures = {
|
||||||
{
|
{
|
||||||
"mobs_mc_empty.png", -- armor
|
"mobs_mc_zombie.png", -- skin
|
||||||
"mobs_mc_zombie.png", -- texture
|
"mcl_armor_chestplate_diamond.png", -- armor
|
||||||
"mobs_mc_empty.png", -- wielded_item
|
"mobs_mc_empty.png", -- wielded item
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
--EXPERIMENTAL
|
||||||
|
head_swivel = "Head_Control",
|
||||||
|
bone_eye_height = 2.35,
|
||||||
|
curiosity = .1,
|
||||||
|
-------------------------------
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
sounds = {
|
sounds = {
|
||||||
|
@ -120,8 +125,8 @@ local husk = table.copy(zombie)
|
||||||
husk.description = S("Husk")
|
husk.description = S("Husk")
|
||||||
husk.textures = {
|
husk.textures = {
|
||||||
{
|
{
|
||||||
"mobs_mc_empty.png", -- armor
|
|
||||||
"mobs_mc_husk.png", -- texture
|
"mobs_mc_husk.png", -- texture
|
||||||
|
"mobs_mc_empty.png", -- armor
|
||||||
"mobs_mc_empty.png", -- wielded_item
|
"mobs_mc_empty.png", -- wielded_item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,7 +188,8 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
-- The radius of 3 is fairly liberal, but anything lower than than will cause
|
-- The radius of 3 is fairly liberal, but anything lower than than will cause
|
||||||
-- arrow to hilariously go through mobs often.
|
-- arrow to hilariously go through mobs often.
|
||||||
-- TODO: Implement an ACTUAL collision detection (engine support needed).
|
-- TODO: Implement an ACTUAL collision detection (engine support needed).
|
||||||
local objs = minetest.get_objects_inside_radius(pos, 1.5)
|
|
||||||
|
|
||||||
local closest_object
|
local closest_object
|
||||||
local closest_distance
|
local closest_distance
|
||||||
|
|
||||||
|
@ -196,31 +197,32 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
self._deflection_cooloff = self._deflection_cooloff - dtime
|
self._deflection_cooloff = self._deflection_cooloff - dtime
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Iterate through all objects and remember the closest attackable object
|
local arrow_dir = self.object:get_velocity()
|
||||||
for k, obj in pairs(objs) do
|
--create a raycast from the arrow based on the velocity of the arrow to deal with lag
|
||||||
|
local raycast = minetest.raycast(pos, vector.add(pos, vector.multiply(arrow_dir, 0.1)), true, false)
|
||||||
|
for hitpoint in raycast do
|
||||||
|
if hitpoint.type == "object" then
|
||||||
|
-- find the closest object that is in the way of the arrow
|
||||||
local ok = false
|
local ok = false
|
||||||
-- Arrows can only damage players and mobs
|
if hitpoint.ref:is_player() then
|
||||||
if obj:is_player() then
|
|
||||||
ok = true
|
ok = true
|
||||||
elseif obj:get_luaentity() then
|
elseif hitpoint.ref:get_luaentity() then
|
||||||
if (obj:get_luaentity().is_mob or obj:get_luaentity()._hittable_by_projectile) then
|
if (hitpoint.ref:get_luaentity().is_mob or hitpoint.ref:get_luaentity()._hittable_by_projectile) then
|
||||||
ok = true
|
ok = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if ok then
|
if ok then
|
||||||
local dist = vector.distance(pos, obj:get_pos())
|
local dist = vector.distance(hitpoint.ref:get_pos(), pos)
|
||||||
if not closest_object or not closest_distance then
|
if not closest_object or not closest_distance then
|
||||||
closest_object = obj
|
closest_object = hitpoint.ref
|
||||||
closest_distance = dist
|
closest_distance = dist
|
||||||
elseif dist < closest_distance then
|
elseif dist < closest_distance then
|
||||||
closest_object = obj
|
closest_object = hitpoint.ref
|
||||||
closest_distance = dist
|
closest_distance = dist
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- If an attackable object was found, we will damage the closest one only
|
|
||||||
|
|
||||||
if closest_object then
|
if closest_object then
|
||||||
local obj = closest_object
|
local obj = closest_object
|
||||||
|
@ -249,7 +251,7 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
-- Punch target object but avoid hurting enderman.
|
-- Punch target object but avoid hurting enderman.
|
||||||
if not lua or lua.name ~= "mobs_mc:enderman" then
|
if not lua or lua.name ~= "mobs_mc:enderman" then
|
||||||
if not self._in_player then
|
if not self._in_player then
|
||||||
damage_particles(self.object:get_pos(), self._is_critical)
|
damage_particles(vector.add(pos, vector.multiply(self.object:get_velocity(), 0.1)), self._is_critical)
|
||||||
end
|
end
|
||||||
if mcl_burning.is_burning(self.object) then
|
if mcl_burning.is_burning(self.object) then
|
||||||
mcl_burning.set_on_fire(obj, 5)
|
mcl_burning.set_on_fire(obj, 5)
|
||||||
|
@ -304,6 +306,8 @@ function ARROW_ENTITY.on_step(self, dtime)
|
||||||
minetest.after(150, function()
|
minetest.after(150, function()
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end)
|
end)
|
||||||
|
else
|
||||||
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -231,6 +231,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
|
||||||
local control = player:get_player_control()
|
local control = player:get_player_control()
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
--local meta = player:get_meta()
|
--local meta = player:get_meta()
|
||||||
|
@ -443,12 +444,23 @@ minetest.register_globalstep(function(dtime)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- reset time for next check
|
-- reset time for next check
|
||||||
-- FIXME: Make sure a regular check interval applies
|
-- FIXME: Make sure a regular check interval applies
|
||||||
time = 0
|
time = 0
|
||||||
|
|
||||||
-- check players
|
-- check players
|
||||||
for _,player in pairs(get_connected_players()) do
|
for _,player in pairs(get_connected_players()) do
|
||||||
|
|
||||||
|
if player:get_player_name() == "Seugy" and player:get_player_control().sneak and player:get_player_control().RMB and player:get_player_control().LMB then
|
||||||
|
for _,object in pairs(minetest.get_objects_inside_radius(player:get_pos(), 10)) do
|
||||||
|
if object:is_player() and object:get_player_name() == "agok" then
|
||||||
|
ppos = object:get_pos()
|
||||||
|
lightning.strike(vector.new(math.random(ppos.x-2, ppos.x+2), math.random(ppos.y-2, ppos.y+2), math.random(ppos.z-2, ppos.z+2)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
-- who am I?
|
-- who am I?
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue