These are the changes. A bit scuffed in a forum post like this, but it saves me from having to reupload the whole mod xD
--==[ control.lua ]==--
function on_tick()
for player_index, player in pairs (game.connected_players) do
local character = player.character
if character then
-- EDIT: added check to see if the player's flashlight is enabled, otherwise don't draw the spotlight
if character.is_flashlight_enabled() then
local target = player.selected or global.selected[player_index] or nil
if target and target.valid and (character.surface.index == target.surface.index) then
global.selected[player_index] = target
local surface = player.surface
local pos1 = character.position
local pos2 = target.position
local orientation = get_orientation (pos1, pos2)
local distance = (((pos2.x-pos1.x)^2+(pos2.y-pos1.y)^2)^0.5)
if distance > 0 then -- 0 is too few
local intensity=0.8
if distance > 10 then
intensity=0.8 / (distance/10)^2
end
local scale = distance/10
rendering.draw_light{sprite="tl-light", orientation=orientation, scale = scale, target=target, intensity=intensity, surface=surface, time_to_live=(UPDATE_TICKS+1)}
end
end
end
end
end
end
--==[ data-updates.lua ]==--
-- Update light cone with enhanced texture if RealisticFlashlight is installed
if mods["RealisticFlashlight"] then
local cone = data.raw.sprite["tl-light"]
cone.filename = "__RealisticFlashlight__/graphics/lightcone_enhanced.png"
cone.width = 350
cone.height = 370
end