1
0
Fork 0

Add medium size mob distinction in the cactus mob damage area reach code

This commit is contained in:
Eliy21 2024-01-21 09:17:15 +00:00
parent b645a2ab67
commit aa4f8ba6cc
1 changed files with 10 additions and 7 deletions

View File

@ -771,10 +771,16 @@ function mob_class:do_env_damage()
local dist = vector.distance(pos, near)
local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near)
local large_mob = false
local medium_mob = false
if self.name == "mobs_mc:ender_dragon" or
self.name == "mobs_mc:ghast" or
self.name == "mobs_mc:guardian_elder" or
self.name == "mobs_mc:hoglin" or
self.name == "mobs_mc:slime_big" or
self.name == "mobs_mc:magma_cube_big" or
self.name == "mobs_mc:wither" then
large_mob = true
elseif self.name == "mobs_mc:hoglin" or
self.name == "mobs_mc:zoglin" or
self.name == "mobs_mc:horse" or
self.name == "mobs_mc:skeleton_horse" or
@ -783,16 +789,13 @@ function mob_class:do_env_damage()
self.name == "mobs_mc:mule" or
self.name == "mobs_mc:iron_golem" or
self.name == "mobs_mc:polar_bear" or
self.name == "mobs_mc:slime_big" or
self.name == "mobs_mc:magma_cube_big" or
self.name == "mobs_mc:spider" or
self.name == "mobs_mc:cave_spider" or
self.name == "mobs_mc:strider" or
self.name == "mobs_mc:wither" then
self.name == "mobs_mc:strider" then
large_mob = true
medium_mob = true
end
if (not large_mob and (dist < 1.03 or dist_feet < 1.6)) or (large_mob and (1.25 or dist_feet < 1.9)) then
if (not large_mob and not medium_mob and (dist < 1.03 or dist_feet < 1.6)) or (medium_mob and (dist < 1.165 or dist_feet < 1.73)) or (large_mob and (dist < 1.25 or dist_feet < 1.9)) then
if self.health ~= 0 then
self:damage_mob("cactus", 2)