Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
dim death screen + proper custom voice box
Browse files Browse the repository at this point in the history
  • Loading branch information
sophfee committed Dec 17, 2021
1 parent d9f1ed8 commit 03fa09d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 9 deletions.
25 changes: 21 additions & 4 deletions plugins/base_hud/cl_hud.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
deathTime = 0
local math = math
local floor = math.floor

local hiddenElements = {
CHudHealth = true,
Expand Down Expand Up @@ -206,6 +208,7 @@ landis.DefineSetting("!B-crosshairGreen",{name="Crosshair Color (Green)",type="s
landis.DefineSetting("!C-crosshairBlue",{name="Crosshair Color (Blue)",type="slider",category="Crosshair",min=1,max=255,dec=0,default=255})
landis.DefineSetting("!D-crosshairLength",{name="Crosshair Length",type="slider",category="Crosshair",min=1,max=16,dec=0,default=5})
landis.DefineSetting("!E-crosshairGap",{name="Crosshair Gap",type="slider",category="Crosshair",min=1,max=16,dec=0,default=5})
landis.DefineSetting("deathScreenDim",{name="Dim Death Screen",type="tickbox",category="UI",default=true})

hook.Add("HUDPaint", "hudPlugin_draw", function()
if not IsValid(ply) then
Expand Down Expand Up @@ -315,8 +318,15 @@ hook.Add("HUDPaint", "hudPlugin_draw", function()
tweenIn:update(FrameTime())
local flatAlpha = math.Clamp(tweenInTable.alpha, 0, 255)

draw.RoundedBox(0, 0, 0, ScrW(), (ScrH()/2)*flatAlpha, team.GetColor(LocalPlayer():Team()))
draw.RoundedBox(0, 0, ScrH()-((ScrH()/2)*flatAlpha), ScrW(), (ScrH()/2), team.GetColor(LocalPlayer():Team()))
local clr = table.Copy(team.GetColor(LocalPlayer():Team()))
if landis.GetSetting("deathScreenDim") then
clr.r = floor(clr.r/3)
clr.g = floor(clr.g/3)
clr.b = floor(clr.b/3)
end

draw.RoundedBox(0, 0, 0, ScrW(), (ScrH()/2)*flatAlpha, clr)
draw.RoundedBox(0, 0, ScrH()-((ScrH()/2)*flatAlpha), ScrW(), (ScrH()/2), clr)

draw.SimpleTextOutlined("YOU ARE DEAD", "DEAD", ScrW()/2, ScrH()/2, Color( 255, 255, 255, flatAlpha * 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER,1,Color(0,0,0,flatAlpha))
end
Expand All @@ -330,9 +340,16 @@ hook.Add("HUDPaint", "hudPlugin_draw", function()
deathTime = math.Clamp(deathTime - FrameTime(),0,1)

tweenOut:update(FrameTime())

local clr = table.Copy(team.GetColor(LocalPlayer():Team()))
if landis.GetSetting("deathScreenDim") then
clr.r = floor(clr.r/3)
clr.g = floor(clr.g/3)
clr.b = floor(clr.b/3)
end

draw.RoundedBox(0, 0, 0, ScrW(), (ScrH()/2)*tweenOutTable.alpha, team.GetColor(LocalPlayer():Team()))
draw.RoundedBox(0, 0, ScrH()-((ScrH()/2)*tweenOutTable.alpha), ScrW(), (ScrH()/2), team.GetColor(LocalPlayer():Team()))
draw.RoundedBox(0, 0, 0, ScrW(), (ScrH()/2)*tweenOutTable.alpha, clr)
draw.RoundedBox(0, 0, ScrH()-((ScrH()/2)*tweenOutTable.alpha), ScrW(), (ScrH()/2), clr)

draw.SimpleTextOutlined("YOU ARE DEAD", "DEAD", ScrW()/2, ScrH()/2, Color( 255, 255, 255, tweenOutTable.alpha * 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER,1,Color(0,0,0,tweenOutTable.alpha))

Expand Down
8 changes: 3 additions & 5 deletions plugins/base_hud/cl_voice.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
return
/*function GM:PlayerStartVoice(ply)
function GM:PlayerStartVoice(ply)

local a = vgui.Create("landisVoice")
local a = vgui.Create("landisVoicePanel")
a.Player = ply
a.Text = ply:Nick() .. " Started Talking"

end

function GM:PlayerEndVoice(ply)
end*/
end
44 changes: 44 additions & 0 deletions plugins/base_hud/vgui/cl_voice.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
PANEL = {}

landis.PlayerVoice = {}

function PANEL:Init()
self.Player = nil
self:SetSize(200,30)
self:SetPos(ScrW()-250,ScrH()-120-(#landis.PlayerVoice*40))
end

function PANEL:SetPlayer(ply)
self.Player = ply
landis.PlayerVoice[ply:EntIndex()] = self
end

function PANEL:Paint(w,h)

if not self.Player then return end

local clr = team.GetColor(self.Player:Team())

surface.SetDrawColor(clr.r,clr.g,clr.b,120)
surface.DrawRect(0, 0, w, h)

landis.blur(self,200,4,4)

surface.SetDrawColor(40,40,40,255)
surface.DrawOutlinedRect(0,0,w,h,2)

surface.SetDrawColor(40,40,40,255)
surface.DrawRect(0,h-4,w*self.Player:VoiceVolume(),2,2)

landis.DrawText(self.Player:GetRPName(),5,h/2,{size=24,bold=true,shadow=true},{x=TEXT_ALIGN_LEFT,y=TEXT_ALIGN_CENTER},color_white)

if not self.Player:IsSpeaking() then

landis.PlayerVoice[self.Player:EntIndex()] = nil
self:Remove()

end

end

vgui.Register("landisVoicePanel",PANEL,"DPanel")

0 comments on commit 03fa09d

Please sign in to comment.