mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-08-27 20:17:25 +02:00
Merge pull request 'Fix enderman' (#1616) from jordan4ibanez/MineClone2:mineclone5 into mineclone5
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1616
This commit is contained in:
commit
adeea8ed43
@ -332,7 +332,7 @@ function mobs:register_mob(name, def)
|
|||||||
--end j4i stuff
|
--end j4i stuff
|
||||||
|
|
||||||
-- MCL2 extensions
|
-- MCL2 extensions
|
||||||
teleport = teleport,
|
teleport = mobs.teleport,
|
||||||
do_teleport = def.do_teleport,
|
do_teleport = def.do_teleport,
|
||||||
spawn_class = def.spawn_class,
|
spawn_class = def.spawn_class,
|
||||||
ignores_nametag = def.ignores_nametag or false,
|
ignores_nametag = def.ignores_nametag or false,
|
||||||
|
@ -667,6 +667,17 @@ mobs.mob_step = function(self, dtime)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--do custom mob instructions
|
||||||
|
if self.do_custom then
|
||||||
|
print("doing custom instructions")
|
||||||
|
-- when false skip going any further
|
||||||
|
if self.do_custom(self, dtime) == false then
|
||||||
|
--this overrides internal lua collision detection
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local attacking = nil
|
local attacking = nil
|
||||||
|
|
||||||
--scan for players within eyesight
|
--scan for players within eyesight
|
||||||
|
@ -134,6 +134,11 @@ mobs.punch_attack_walk = function(self,dtime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--auto reset punch_timer
|
||||||
|
if not self.punch_timer then
|
||||||
|
self.punch_timer = 0
|
||||||
|
end
|
||||||
|
|
||||||
if self.punch_timer > 0 then
|
if self.punch_timer > 0 then
|
||||||
self.punch_timer = self.punch_timer - dtime
|
self.punch_timer = self.punch_timer - dtime
|
||||||
end
|
end
|
||||||
|
@ -309,13 +309,7 @@ local falling = function(self, pos)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local teleport = function(self, target)
|
|
||||||
if self.do_teleport then
|
|
||||||
if self.do_teleport(self, target) == false then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- find someone to runaway from
|
-- find someone to runaway from
|
||||||
|
@ -205,3 +205,13 @@ mobs.node_ok = function(pos, fallback)
|
|||||||
|
|
||||||
return minetest_registered_nodes[fallback]
|
return minetest_registered_nodes[fallback]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--a teleport functoin
|
||||||
|
mobs.teleport = function(self, target)
|
||||||
|
if self.do_teleport then
|
||||||
|
if self.do_teleport(self, target) == false then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -192,18 +192,19 @@ local mobs_griefing = minetest.settings:get_bool("mobs_griefing") ~= false
|
|||||||
mobs:register_mob("mobs_mc:enderman", {
|
mobs:register_mob("mobs_mc:enderman", {
|
||||||
type = "monster",
|
type = "monster",
|
||||||
spawn_class = "passive",
|
spawn_class = "passive",
|
||||||
passive = true,
|
neutral = true,
|
||||||
pathfinding = 1,
|
|
||||||
hp_min = 40,
|
hp_min = 40,
|
||||||
hp_max = 40,
|
hp_max = 40,
|
||||||
xp_min = 5,
|
xp_min = 5,
|
||||||
xp_max = 5,
|
xp_max = 5,
|
||||||
|
rotate = 270,
|
||||||
collisionbox = {-0.3, -0.01, -0.3, 0.3, 2.89, 0.3},
|
collisionbox = {-0.3, -0.01, -0.3, 0.3, 2.89, 0.3},
|
||||||
visual = "mesh",
|
visual = "mesh",
|
||||||
mesh = "mobs_mc_enderman.b3d",
|
mesh = "mobs_mc_enderman.b3d",
|
||||||
textures = create_enderman_textures(),
|
textures = create_enderman_textures(),
|
||||||
visual_size = {x=3, y=3},
|
visual_size = {x=3, y=3},
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
|
eye_height = 2.5,
|
||||||
sounds = {
|
sounds = {
|
||||||
-- TODO: Custom war cry sound
|
-- TODO: Custom war cry sound
|
||||||
war_cry = "mobs_sandmonster",
|
war_cry = "mobs_sandmonster",
|
||||||
@ -212,8 +213,8 @@ mobs:register_mob("mobs_mc:enderman", {
|
|||||||
random = {name="mobs_mc_enderman_random", gain=0.5},
|
random = {name="mobs_mc_enderman_random", gain=0.5},
|
||||||
distance = 16,
|
distance = 16,
|
||||||
},
|
},
|
||||||
walk_velocity = 0.2,
|
walk_velocity = 1,
|
||||||
run_velocity = 3.4,
|
run_velocity = 4,
|
||||||
damage = 7,
|
damage = 7,
|
||||||
reach = 2,
|
reach = 2,
|
||||||
drops = {
|
drops = {
|
||||||
@ -281,8 +282,8 @@ mobs:register_mob("mobs_mc:enderman", {
|
|||||||
--self:teleport(nil)
|
--self:teleport(nil)
|
||||||
--self.state = ""
|
--self.state = ""
|
||||||
--else
|
--else
|
||||||
if self.attack then
|
if self.attacking then
|
||||||
local target = self.attack
|
local target = self.attacking
|
||||||
local pos = target:get_pos()
|
local pos = target:get_pos()
|
||||||
if pos ~= nil then
|
if pos ~= nil then
|
||||||
if vector.distance(self.object:get_pos(), target:get_pos()) > 10 then
|
if vector.distance(self.object:get_pos(), target:get_pos()) > 10 then
|
||||||
@ -359,11 +360,16 @@ mobs:register_mob("mobs_mc:enderman", {
|
|||||||
--if looking in general head position, turn hostile
|
--if looking in general head position, turn hostile
|
||||||
if minetest.line_of_sight(ender_eye_pos, look_pos_base) and vector.distance(look_pos, ender_eye_pos) <= 0.4 then
|
if minetest.line_of_sight(ender_eye_pos, look_pos_base) and vector.distance(look_pos, ender_eye_pos) <= 0.4 then
|
||||||
self.provoked = "staring"
|
self.provoked = "staring"
|
||||||
self.attack = minetest.get_player_by_name(obj:get_player_name())
|
self.state = "stand"
|
||||||
|
self.hostile = false
|
||||||
break
|
break
|
||||||
else -- I'm not sure what this part does, but I don't want to break anything - jordan4ibanez
|
--begin attacking the player
|
||||||
|
else
|
||||||
if self.provoked == "staring" then
|
if self.provoked == "staring" then
|
||||||
self.provoked = "broke_contact"
|
self.provoked = "broke_contact"
|
||||||
|
self.hostile = true
|
||||||
|
self.state = "attack"
|
||||||
|
self.attacking = obj
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -556,7 +562,7 @@ mobs:register_mob("mobs_mc:enderman", {
|
|||||||
water_damage = 8,
|
water_damage = 8,
|
||||||
view_range = 64,
|
view_range = 64,
|
||||||
fear_height = 4,
|
fear_height = 4,
|
||||||
attack_type = "dogfight",
|
attack_type = "punch",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user