mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
38
lua/pac3/core/server/in_skybox.lua
Normal file
38
lua/pac3/core/server/in_skybox.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
hook.Add("InitPostEntity","pac_get_sky_camera",function()
|
||||
local sky_camera = ents.FindByClass("sky_camera")[1]
|
||||
if sky_camera then
|
||||
local nwVarName = "pac_in_skybox"
|
||||
local in_skybox = {}
|
||||
|
||||
timer.Create("pac_in_skybox", 0.5, 0, function()
|
||||
if not IsValid(sky_camera) then
|
||||
sky_camera = ents.FindByClass("sky_camera")[1]
|
||||
end
|
||||
local new_in_skybox = {}
|
||||
for _, ent in ipairs(ents.FindInPVS(sky_camera:GetPos())) do
|
||||
if not in_skybox[ent] then
|
||||
ent:SetNW2Bool(nwVarName, true)
|
||||
end
|
||||
new_in_skybox[ent] = true
|
||||
end
|
||||
|
||||
for ent in pairs(in_skybox) do
|
||||
if not new_in_skybox[ent] and ent:IsValid() then
|
||||
ent:SetNW2Bool(nwVarName, false)
|
||||
end
|
||||
end
|
||||
|
||||
in_skybox = new_in_skybox
|
||||
end)
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user