summaryrefslogtreecommitdiff
path: root/gamemode/sv_various/hooks.lua
blob: 58bfcb469382074cbb2d79d45cd045fa4a3da5ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// :O

util.AddNetworkString( "SunPos" )


hook.Add("Initialize","LoadGearFox",function() 
	resource.AddDir("materials/gearfox") 
	resource.AddDir("materials/mawbase") 
	resource.AddDir("models/gearfox") 
	resource.AddDir("sound/mawbase") 
end)


hook.Add("InitPostEntity","LoadGearFoxSunPos",function()
	local Sun = ents.FindByClass("env_sun")[1]
	
	if (!IsValid(Sun)) then return end
	
	GM = GM or GAMEMODE
	
	local Ang = Sun:GetAngles()
	Ang.p = Sun:GetKeyValues().pitch
	Ang.y = Ang.y+180
	
	local Pos = Ang:Forward()*10
		
	GM:SetGlobalSHVar("SunPos",Pos)
end)