Relax "full sunlight" requirements for mechanics

Any gameplay mechanic that could be done before only in full
direct sunlight now works anywhere using the light from an
immediately adjacent shining lens.

The only things that still require full true sunlight are purely
cosmetic things like ambient sound effects.
This commit is contained in:
Aaron Suen 2024-09-12 18:40:26 -04:00
parent 803448d0f0
commit 89c28203ad
3 changed files with 7 additions and 3 deletions

View File

@ -451,6 +451,10 @@ function nodecore.is_full_sun(pos)
return pos.y >= 0 and minetest.get_node_light(pos, 0.5) == nodecore.light_sun
end
function nodecore.is_max_light(pos)
return nodecore.is_full_sun(pos) or minetest.get_node_light(pos, 0) >= 11
end
function nodecore.get_node_light(pos)
local artificial = minetest.get_node_light(pos, 0)
if not artificial then return end

View File

@ -268,7 +268,7 @@ nodecore.register_on_peat_compost(function(pos)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
if not (nodecore.air_equivalent(above)
and nodecore.is_full_sun(above)
and nodecore.is_max_light(above)
and flowerable(above)
and #nodecore.find_nodes_around(above, "group:moist", {2, 2, 2}) > 0)
then return end

View File

@ -57,7 +57,7 @@ minetest.register_abm({
arealoaded = 1,
action = function(pos)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
if nodecore.is_full_sun(above) and #findwater(pos) < 1 then
if nodecore.is_max_light(above) and #findwater(pos) < 1 then
nodecore.sound_play("nc_api_craft_hiss", {gain = 0.02, pos = pos})
return minetest.set_node(pos, {name = modname .. ":sponge"})
end
@ -73,7 +73,7 @@ nodecore.register_aism({
action = function(stack, data)
if data.player and (data.list ~= "main"
or data.slot ~= data.player:get_wield_index()) then return end
if data.pos and nodecore.is_full_sun(data.pos)
if data.pos and nodecore.is_max_light(data.pos)
and #findwater(data.pos) < 1 then
nodecore.sound_play("nc_api_craft_hiss", {gain = 0.02, pos = data.pos})
local taken = stack:take_item(1)