Compare commits

..

3 Commits
v1.1.0 ... main

Author SHA1 Message Date
Till Affeldt
7ac833bb19 Add patch for climate_api to disable MTG weather 2024-09-27 00:52:46 +02:00
Till Affeldt
8108a5d585 Update Readme to include new features 2024-09-27 00:39:17 +02:00
Till Affeldt
a65f43bded Implement new lighting features 2024-09-27 00:28:24 +02:00
3 changed files with 39 additions and 4 deletions

View File

@ -15,15 +15,17 @@ Each property of the lighting definition will be aggregated with the respective
Properties will be aggregated in different ways. Here is the full list:
- `saturation` will be __multiplied__
- `shadows`
- `intensity` will be __multiplied__
- `exposure`
- `luminance_min` will be __added__
- `luminance_max` will be __added__
- `speed_dark_bright` will be __multiplied__
- `speed_bright_dark` will be __multiplied__
- `center_weight_power` will be __multiplied__
- `saturation` will be __multiplied__
- `shadows`
- `intensity` will be __multiplied__
- `tint` values will be __maxed__
- `volumetric_light` will be __maxed__
### Example

View File

@ -7,6 +7,11 @@ if weather == nil or weather.get == nil then
return
end
-- leave it to climate_api to disable
if minetest.get_modpath("climate_api") then
return
end
-- prevent mod from triggering lighting updates itself
local old_get = weather.get
weather.get = function(player)

View File

@ -5,6 +5,11 @@ local monoid_definition = {
shadows = {
intensity = "multiply",
},
tint = {
r = "max_255",
g = "max_255",
b = "max_255"
},
saturation = "multiply",
exposure = {
luminance_min = "add",
@ -13,16 +18,31 @@ local monoid_definition = {
speed_dark_bright = "multiply",
speed_bright_dark = "multiply",
center_weight_power = "multiply"
},
volumetric_light = {
strength = "max_1"
}
}
-- default values that don't reflect neutral operations
-- neutral values
local lighting_defaults = {
shadows = {
intensity = 1,
},
tint = {
r = 0,
g = 0,
b = 0
},
saturation = 1,
exposure = {
luminance_min = -3,
luminance_max = -3,
speed_dark_bright = 1000,
speed_bright_dark = 1000,
},
volumetric_light = {
strength = 0
}
}
@ -36,6 +56,14 @@ function methods.multiply(a, b)
return a * b
end
function methods.max_1(a, b)
return math.min(math.max(math.max(a, b), 0), 1)
end
function methods.max_255(a, b)
return math.min(math.max(math.max(a, b), 0), 255)
end
-- combine tables using specified methods
local function combine(definition, tabA, tabB)
-- at least one table has undefined value