forked from VoxeLibre/VoxeLibre
Remove unnecessary raycast from rover (and use the mcl_burning api where we can)
This commit is contained in:
parent
eb3a8b0e6a
commit
1c8f65d9b5
|
@ -653,7 +653,7 @@ function mob_class:do_env_damage()
|
||||||
local _, dim = mcl_worlds.y_to_layer(pos.y)
|
local _, dim = mcl_worlds.y_to_layer(pos.y)
|
||||||
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (sunlight or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
if (self.sunlight_damage ~= 0 or self.ignited_by_sunlight) and (sunlight or 0) >= minetest.LIGHT_MAX and dim == "overworld" then
|
||||||
if self.armor_list and not self.armor_list.helmet or not self.armor_list or self.armor_list and self.armor_list.helmet and self.armor_list.helmet == "" then
|
if self.armor_list and not self.armor_list.helmet or not self.armor_list or self.armor_list and self.armor_list.helmet and self.armor_list.helmet == "" then
|
||||||
if (self.ignited_by_sunlight and (not mcl_weather.rain.raining or not mcl_weather.has_rain(pos))) then
|
if self.ignited_by_sunlight and (not mcl_weather.rain.raining or not mcl_weather.has_rain(pos)) then
|
||||||
if (#mcl_burning.get_touching_nodes(self.object, "group:puts_out_fire", self) == 0) then
|
if (#mcl_burning.get_touching_nodes(self.object, "group:puts_out_fire", self) == 0) then
|
||||||
mcl_burning.set_on_fire(self.object, 10)
|
mcl_burning.set_on_fire(self.object, 10)
|
||||||
end
|
end
|
||||||
|
@ -694,9 +694,11 @@ function mob_class:do_env_damage()
|
||||||
local nodef3 = minetest.registered_nodes[self.standing_under]
|
local nodef3 = minetest.registered_nodes[self.standing_under]
|
||||||
|
|
||||||
-- rain
|
-- rain
|
||||||
if self.rain_damage > 0 and mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) then
|
if self.rain_damage > 0 and mcl_burning.is_affected_by_rain(self.object) then
|
||||||
self.health = self.health - self.rain_damage
|
self.health = self.health - self.rain_damage
|
||||||
if self:check_for_death("rain", {type = "environment", pos = pos, node = self.standing_in}) then
|
|
||||||
|
if self:check_for_death("rain", {type = "environment",
|
||||||
|
pos = pos, node = self.standing_in}) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -156,37 +156,15 @@ mcl_mobs.register_mob("mobs_mc:rover", {
|
||||||
-- RAIN DAMAGE / EVASIVE WARP BEHAVIOUR HERE.
|
-- RAIN DAMAGE / EVASIVE WARP BEHAVIOUR HERE.
|
||||||
local enderpos = self.object:get_pos()
|
local enderpos = self.object:get_pos()
|
||||||
local dim = mcl_worlds.pos_to_dimension(enderpos)
|
local dim = mcl_worlds.pos_to_dimension(enderpos)
|
||||||
if dim == "overworld" then
|
if dim == "overworld" and mcl_burning.is_affected_by_rain(self.object) then
|
||||||
if mcl_weather.rain.raining then
|
self.state = ""
|
||||||
local damage = true
|
--rain hurts enderman
|
||||||
local enderpos = self.object:get_pos()
|
self.object:punch(self.object, 1.0, {
|
||||||
enderpos.y = enderpos.y+2.89
|
full_punch_interval=1.0,
|
||||||
local height = {x=enderpos.x, y=enderpos.y+512,z=enderpos.z}
|
damage_groups={fleshy=self._damage},
|
||||||
local ray = minetest.raycast(enderpos, height, true)
|
}, nil)
|
||||||
-- Check for blocks above enderman.
|
--randomly teleport hopefully under something.
|
||||||
for pointed_thing in ray do
|
self:teleport(nil)
|
||||||
if pointed_thing.type == "node" then
|
|
||||||
local nn = minetest.get_node(minetest.get_pointed_thing_position(pointed_thing)).name
|
|
||||||
local def = minetest.registered_nodes[nn]
|
|
||||||
if (not def) or def.walkable then
|
|
||||||
-- There's a node in the way. Delete arrow without damage
|
|
||||||
damage = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if damage == true then
|
|
||||||
self.state = ""
|
|
||||||
--rain hurts enderman
|
|
||||||
self.object:punch(self.object, 1.0, {
|
|
||||||
full_punch_interval=1.0,
|
|
||||||
damage_groups={fleshy=self._damage},
|
|
||||||
}, nil)
|
|
||||||
--randomly teleport hopefully under something.
|
|
||||||
self:teleport(nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
|
-- AGRESSIVELY WARP/CHASE PLAYER BEHAVIOUR HERE.
|
||||||
|
|
Loading…
Reference in New Issue