Facepunch / garrysmod-requests

Feature requests for Garry's Mod
84 stars 24 forks source link

Add a hook lua code for getting the darkness #1914

Open oNyaaaa opened 3 years ago

oNyaaaa commented 3 years ago

Details

Add a hook lua code for getting the darkness

also a player:IsInDarkness hook too!

hook.Add("Darkness", "Lua", function(ply,light,darkness) if light then print("we're in the the light") end if darkness then print("we're in the darkness") end end)

gm_construct has darkness areas where you can't get the pitch of the darkness in lua, I've looked on the wiki!

oNyaaaa commented 3 years ago

Tried using print(render.GetLightColor( LocalPlayer():GetPos() )) doesn't really do anything other then give a vector 0 0 0 for darkness

CornerPin commented 3 years ago

You can use render.GetLightColor, render.ComputeLighting and render.ComputeDynamicLighting to calculate the light level at a certain position.

oNyaaaa commented 3 years ago

Okay, Thanks i guess, Would've been better of there was a hook.