mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-01 06:51:10 +01:00
Add parenthesis for clarity, check pos before using, endermen->rovers in comment
This commit is contained in:
parent
835f97a61e
commit
2f4e23e403
3 changed files with 4 additions and 2 deletions
|
@ -15,6 +15,7 @@ end
|
||||||
|
|
||||||
function mcl_burning.is_affected_by_rain(obj)
|
function mcl_burning.is_affected_by_rain(obj)
|
||||||
local pos = obj:get_pos()
|
local pos = obj:get_pos()
|
||||||
|
if not pos then return false end
|
||||||
return mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) and mcl_weather.has_rain(pos)
|
return mcl_weather.rain.raining and mcl_weather.is_outdoor(pos) and mcl_weather.has_rain(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ function mcl_burning.is_affected_by_sunlight(obj, threshold)
|
||||||
threshold = threshold or core.LIGHT_MAX
|
threshold = threshold or core.LIGHT_MAX
|
||||||
|
|
||||||
local pos = obj:get_pos()
|
local pos = obj:get_pos()
|
||||||
|
if not pos then return false end
|
||||||
local _,dim = mcl_worlds.y_to_layer(pos.y)
|
local _,dim = mcl_worlds.y_to_layer(pos.y)
|
||||||
if dim ~= "overworld" then return false end
|
if dim ~= "overworld" then return false end
|
||||||
|
|
||||||
|
|
|
@ -635,7 +635,7 @@ function mob_class:do_env_damage()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Simple light damage
|
-- Simple light damage
|
||||||
if self.light_damage or 0 > 0 and mcl_burning.is_affected_by_sunlight(self.object, 12) then
|
if (self.light_damage or 0) > 0 and mcl_burning.is_affected_by_sunlight(self.object, 12) then
|
||||||
if self:deal_light_damage(pos, self.light_damage) then
|
if self:deal_light_damage(pos, self.light_damage) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
|
@ -158,7 +158,7 @@ mcl_mobs.register_mob("mobs_mc:rover", {
|
||||||
local dim = mcl_worlds.pos_to_dimension(enderpos)
|
local dim = mcl_worlds.pos_to_dimension(enderpos)
|
||||||
if dim == "overworld" and mcl_burning.is_affected_by_rain(self.object) then
|
if dim == "overworld" and mcl_burning.is_affected_by_rain(self.object) then
|
||||||
self.state = ""
|
self.state = ""
|
||||||
--rain hurts enderman
|
--rain hurts rovers
|
||||||
self.object:punch(self.object, 1.0, {
|
self.object:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=self.rain_damage},
|
damage_groups={fleshy=self.rain_damage},
|
||||||
|
|
Loading…
Reference in a new issue