-------------------------------
-- SSTRP
-- Author: MNWRP
--
-- cl_init.lua
-- This file calls the rest of the script
-- As you can see, the clientside of CakeScript is pretty simple compared to the serverside.
-------------------------------

-- Define global variables
Running = false;
Loaded = false;

models = {  };
readysent = false;

-- Client Includes
include( "shared.lua" );
include( "player_shared.lua" );
include( "cl_hud.lua" );
include( "cl_binds.lua" );
include( "cl_charactercreate.lua" );
include( "cl_playermenu.lua" );
include( "cl_chat.lua" );
include( "cl_dermaskin.lua" );

Loaded = true;

-- Initialize the gamemode
function GM:Initialize( )

	Running = true;

	self.BaseClass:Initialize( );

end

function GM:Think( )

	if( vgui and readysent == false ) then -- VGUI is initalized, tell the server we're ready for character creation.
	
		LocalPlayer( ):ConCommand( "rp_ready\n" );
		readysent = true;
		
	end
	
end

function GM:ForceDermaSkin()
      return "nocturnal"
end 

SeeAll = false;

function msgSeeAll( msg )

	SeeAll = !SeeAll;

end
usermessage.Hook( "ToggleSeeAll", msgSeeAll );

--[[
function BlurrHurtEffects()
	if( LocalPlayer():Health() > 30 and LocalPlayer():Health() < 50 ) then
		local ScrColTab = {}
		ScrColTab[ "$pp_colour_addr" ] 		= 0
		ScrColTab[ "$pp_colour_addg" ] 		= 0
		ScrColTab[ "$pp_colour_addb" ] 		= 0
		ScrColTab[ "$pp_colour_brightness" ]= - 0.35
		ScrColTab[ "$pp_colour_contrast" ] 	= 1.0
		ScrColTab[ "$pp_colour_colour" ] 	= 1
		ScrColTab[ "$pp_colour_mulr" ] 		= 1
		ScrColTab[ "$pp_colour_mulg" ] 		= 1
		ScrColTab[ "$pp_colour_mulb" ] 		= 1
		DrawColorModify( ScrColTab )
		DrawMotionBlur( 0.2, 1, 0 )
	end
end
hook.Add("RenderScreenspaceEffects", "BlurrHurtEffects", BlurrHurtEffects)

local Hurt, HurtMax, MaxHealth, FadeScale, clamp, FrameTime, LastHealth = 0, 255, 100, 1, math.Clamp, FrameTime, 0
local function OnThink()
	local h = LocalPlayer():Health()
		if h < LastHealth then
			Hurt = Hurt + ( LastHealth - h ) / MaxHealth * HurtMax
		end
	Hurt = clamp( Hurt - FrameTime() * HurtMax * FadeScale, 0, HurtMax )
	LastHealth = h
end

local HurtColour = {
	["$pp_colour_addr"    ] = 0,
	["$pp_colour_addg"    ] = 0,
	["$pp_colour_addb"    ] = 0,
    ["$pp_colour_brightness"] = 0,
    ["$pp_colour_contrast"  ] = 1,
    ["$pp_colour_colour"    ] = 1,
    ["$pp_colour_mulr"    ] = 1,
    ["$pp_colour_mulg"    ] = 1,
    ["$pp_colour_mulb"    ] = 1
 }
 
local DrawColorModify = DrawColorModify
local function DrawInjuryEffect()
	HurtColour["$pp_colour_addr"] = Hurt
	DrawColorModify(HurtColour)
end

local function OnInitialize()
	hook.Add("RenderScreenspaceEffects", "RenderIt", DrawInjuryEffect)
	hook.Add("Think", "Thinklol", OnThink)
end 
hook.Add("Initialize", "HurtEffects", OnInitialize)
--]]
