Skip to content

Commit

Permalink
Adds volumetric lighting support - astra0081 (#1371)
Browse files Browse the repository at this point in the history
  • Loading branch information
LoneWolfHT committed Jan 11, 2025
1 parent 1db60c1 commit 7c2898e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion mods/ctf/ctf_modebase/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ ctf_settings.register("flag_sound_volume", {
step = 1,
})

local DEFAULT_VOLUMETRIC_LIGHTING = 10
ctf_settings.register("volumetric_lighting", {
type = "bar",
label = "Volumetric Lighting Strength",
default = tostring(DEFAULT_VOLUMETRIC_LIGHTING),
min = 0,
max = 50,
step = 1,
on_change = function(player)
ctf_modebase.player.update(player)
end
})

local simplify_for_saved_stuff = function(iname)
if not iname or iname == "" then return iname end

Expand Down Expand Up @@ -362,7 +375,14 @@ function ctf_modebase.player.update(player)

skybox.set(player, table.indexof(ctf_map.skyboxes, map.skybox)-1)

player:set_lighting({shadows = {intensity = map.enable_shadows}})
player:set_lighting({
shadows = {
intensity = map.enable_shadows,
},
volumetric_light = {
strength = (tonumber(ctf_settings.get(player, "volumetric_lighting")) or DEFAULT_VOLUMETRIC_LIGHTING)/100,
},
})

physics.set(player:get_player_name(), "ctf_modebase:map_physics", {
speed = map.phys_speed,
Expand Down

0 comments on commit 7c2898e

Please sign in to comment.