forked from MineClone5/MineClone5
Implement eye_height and viewing range for hostile mobs, along with making punchy mobs jump over nodes
This commit is contained in:
parent
a05ebd7cc2
commit
8c9356a18c
|
@ -345,6 +345,7 @@ function mobs:register_mob(name, def)
|
||||||
fire_resistant = def.fire_resistant or false,
|
fire_resistant = def.fire_resistant or false,
|
||||||
fire_damage_resistant = def.fire_damage_resistant or false,
|
fire_damage_resistant = def.fire_damage_resistant or false,
|
||||||
ignited_by_sunlight = def.ignited_by_sunlight or false,
|
ignited_by_sunlight = def.ignited_by_sunlight or false,
|
||||||
|
eye_height = def.eye_height or 1.5,
|
||||||
-- End of MCL2 extensions
|
-- End of MCL2 extensions
|
||||||
|
|
||||||
on_spawn = def.on_spawn,
|
on_spawn = def.on_spawn,
|
||||||
|
|
|
@ -574,9 +574,7 @@ mobs.mob_step = function(self, dtime)
|
||||||
|
|
||||||
if self.hostile then
|
if self.hostile then
|
||||||
--true for line_of_sight is debug
|
--true for line_of_sight is debug
|
||||||
--10 for radius is debug
|
local attacking = mobs.detect_closest_player_within_radius(self,true,self.view_range,self.eye_height)
|
||||||
--1 for eye height adjust is debug
|
|
||||||
local attacking = mobs.detect_closest_player_within_radius(self,true,10,1)
|
|
||||||
|
|
||||||
--go get the closest player ROAR >:O
|
--go get the closest player ROAR >:O
|
||||||
if attacking then
|
if attacking then
|
||||||
|
|
|
@ -107,6 +107,15 @@ mobs.punch_attack_walk = function(self,dtime)
|
||||||
|
|
||||||
mobs.set_mob_animation(self, "run")
|
mobs.set_mob_animation(self, "run")
|
||||||
|
|
||||||
|
--make punchy mobs jump
|
||||||
|
--check for nodes to jump over
|
||||||
|
--explosive mobs will just ride against walls for now
|
||||||
|
local node_in_front_of = mobs.jump_check(self)
|
||||||
|
if node_in_front_of == 1 then
|
||||||
|
mobs.jump(self)
|
||||||
|
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
|
||||||
|
|
|
@ -41,7 +41,7 @@ mobs:register_mob("mobs_mc:creeper", {
|
||||||
run_velocity = 2.1,
|
run_velocity = 2.1,
|
||||||
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
||||||
attack_type = "explode",
|
attack_type = "explode",
|
||||||
|
eye_height = 1.25,
|
||||||
--hssssssssssss
|
--hssssssssssss
|
||||||
|
|
||||||
explosion_strength = 10,
|
explosion_strength = 10,
|
||||||
|
|
|
@ -71,6 +71,7 @@ local zombie = {
|
||||||
damage = "mobs_mc_zombie_hurt",
|
damage = "mobs_mc_zombie_hurt",
|
||||||
distance = 16,
|
distance = 16,
|
||||||
},
|
},
|
||||||
|
eye_height = 1.65,
|
||||||
walk_velocity = 1,
|
walk_velocity = 1,
|
||||||
run_velocity = 3,
|
run_velocity = 3,
|
||||||
damage = 3,
|
damage = 3,
|
||||||
|
|
Loading…
Reference in New Issue