Add parenthesis for clarity, check pos before using, endermen->rovers in comment

This commit is contained in:
teknomunk 2024-11-30 09:03:36 -06:00
parent 835f97a61e
commit 2f4e23e403
3 changed files with 4 additions and 2 deletions

View file

@ -15,6 +15,7 @@ end
function mcl_burning.is_affected_by_rain(obj)
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)
end
@ -22,6 +23,7 @@ function mcl_burning.is_affected_by_sunlight(obj, threshold)
threshold = threshold or core.LIGHT_MAX
local pos = obj:get_pos()
if not pos then return false end
local _,dim = mcl_worlds.y_to_layer(pos.y)
if dim ~= "overworld" then return false end

View file

@ -635,7 +635,7 @@ function mob_class:do_env_damage()
end
-- 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
return true
end

View file

@ -158,7 +158,7 @@ mcl_mobs.register_mob("mobs_mc:rover", {
local dim = mcl_worlds.pos_to_dimension(enderpos)
if dim == "overworld" and mcl_burning.is_affected_by_rain(self.object) then
self.state = ""
--rain hurts enderman
--rain hurts rovers
self.object:punch(self.object, 1.0, {
full_punch_interval=1.0,
damage_groups={fleshy=self.rain_damage},