mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
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
5 changed files with 13 additions and 4 deletions
|
@ -345,6 +345,7 @@ function mobs:register_mob(name, def)
|
|||
fire_resistant = def.fire_resistant or false,
|
||||
fire_damage_resistant = def.fire_damage_resistant or false,
|
||||
ignited_by_sunlight = def.ignited_by_sunlight or false,
|
||||
eye_height = def.eye_height or 1.5,
|
||||
-- End of MCL2 extensions
|
||||
|
||||
on_spawn = def.on_spawn,
|
||||
|
|
|
@ -574,9 +574,7 @@ mobs.mob_step = function(self, dtime)
|
|||
|
||||
if self.hostile then
|
||||
--true for line_of_sight is debug
|
||||
--10 for radius is debug
|
||||
--1 for eye height adjust is debug
|
||||
local attacking = mobs.detect_closest_player_within_radius(self,true,10,1)
|
||||
local attacking = mobs.detect_closest_player_within_radius(self,true,self.view_range,self.eye_height)
|
||||
|
||||
--go get the closest player ROAR >:O
|
||||
if attacking then
|
||||
|
|
|
@ -107,6 +107,15 @@ mobs.punch_attack_walk = function(self,dtime)
|
|||
|
||||
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
|
||||
self.punch_timer = self.punch_timer - dtime
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ mobs:register_mob("mobs_mc:creeper", {
|
|||
run_velocity = 2.1,
|
||||
runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" },
|
||||
attack_type = "explode",
|
||||
|
||||
eye_height = 1.25,
|
||||
--hssssssssssss
|
||||
|
||||
explosion_strength = 10,
|
||||
|
|
|
@ -71,6 +71,7 @@ local zombie = {
|
|||
damage = "mobs_mc_zombie_hurt",
|
||||
distance = 16,
|
||||
},
|
||||
eye_height = 1.65,
|
||||
walk_velocity = 1,
|
||||
run_velocity = 3,
|
||||
damage = 3,
|
||||
|
|
Loading…
Reference in a new issue