mirror of
https://github.com/CFC-Servers/cfc_chip_lister.git
synced 2025-03-04 03:03:14 -05:00
Apply suggestions
This commit is contained in:
parent
583dba9b20
commit
33bda0fc54
@ -204,7 +204,7 @@ hook.Add( "InitPostEntity", "CFC_ChipLister_InformServerOfPlayerChoice", functio
|
||||
end )
|
||||
end )
|
||||
|
||||
hook.Add( "KeyPress", "CFC_ChipLister_ToggleScreen", function( ply, key ) -- ply i always LocalPlayer() on client
|
||||
hook.Add( "KeyPress", "CFC_ChipLister_ToggleScreen", function( ply, key ) -- ply is always LocalPlayer() on client
|
||||
if key ~= IN_USE then return end
|
||||
|
||||
local tr = ply:GetEyeTrace()
|
||||
|
@ -207,7 +207,7 @@ hook.Add( "OnEntityRemoved", "CFC_ChipLister_ChipRemoved", function( ent )
|
||||
end )
|
||||
|
||||
hook.Add( "PlayerDisconnected", "CFC_ChipLister_UpdateListUserCount", function( ply )
|
||||
if not ( ply or {} ).cfcChipLister_usesLister then return end
|
||||
if not ply or not ply.cfcChipLister_usesLister then return end
|
||||
|
||||
local ind = tableKeyFromValue( listUsers, ply )
|
||||
|
||||
|
@ -22,6 +22,25 @@ local hudPosX = HUD_POS_X:GetFloat()
|
||||
local hudPosY = HUD_POS_Y:GetFloat()
|
||||
|
||||
|
||||
local function applyOrRemoveHUDLister()
|
||||
if not hudEnabled then
|
||||
hook.Remove( "HUDPaint", "CFC_ChipLister_DrawHUD" )
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
hook.Add( "HUDPaint", "CFC_ChipLister_DrawHUD", function()
|
||||
local scrW = ScrW()
|
||||
local scrH = ScrH()
|
||||
local size = hudScale * scrW
|
||||
|
||||
surface.SetMaterial( matChipLister )
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.DrawTexturedRect( hudPosX * scrW, hudPosY * scrH, size, size )
|
||||
end )
|
||||
end
|
||||
|
||||
|
||||
hook.Add( "AddToolMenuCategories", "CFC_ChipLister_AddToolMenuCategories", function()
|
||||
spawnmenu.AddToolCategory( "Options", "CFC", "#CFC" )
|
||||
end )
|
||||
@ -55,6 +74,7 @@ end )
|
||||
|
||||
cvars.AddChangeCallback( "cfc_chiplister_hud_enabled", function( _, old, new )
|
||||
hudEnabled = new ~= "0"
|
||||
applyOrRemoveHUDLister()
|
||||
end )
|
||||
|
||||
cvars.AddChangeCallback( "cfc_chiplister_hud_scale", function( _, old, new )
|
||||
@ -69,14 +89,5 @@ cvars.AddChangeCallback( "cfc_chiplister_hud_pos_y", function( _, old, new )
|
||||
hudPosY = tonumber( new ) or 0.1
|
||||
end )
|
||||
|
||||
hook.Add( "HUDPaint", "CFC_ChipLister_DrawHUD", function()
|
||||
if not hudEnabled then return end
|
||||
|
||||
local scrW = ScrW()
|
||||
local scrH = ScrH()
|
||||
local size = hudScale * scrW
|
||||
|
||||
surface.SetMaterial( matChipLister )
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.DrawTexturedRect( hudPosX * scrW, hudPosY * scrH, size, size )
|
||||
end )
|
||||
applyOrRemoveHUDLister()
|
||||
|
@ -6,9 +6,9 @@ include( "shared.lua" )
|
||||
local ErrorModel = "models/error.mdl"
|
||||
|
||||
function ENT:KeyValue( key, value )
|
||||
if key == "model" then
|
||||
self.Model = value
|
||||
end
|
||||
if key == "model" then
|
||||
self.Model = value
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
@ -18,7 +18,6 @@ function ENT:Initialize()
|
||||
self:SetModel( self.Model )
|
||||
end
|
||||
|
||||
--self:SetModel( "models/hunter/plates/plate16x16.mdl" )
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
||||
self:SetSolid( SOLID_VPHYSICS )
|
||||
|
@ -6,7 +6,7 @@ ENT.Author = "legokidlogan"
|
||||
ENT.Contact = "https://cfcservers.org/discord"
|
||||
ENT.Purpose = "Displays E2 and Starfall chips"
|
||||
ENT.Instructions = ""
|
||||
ENT.Category = "Chip Lister"
|
||||
ENT.Category = "Chip Lister"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.Model = "models/hunter/plates/plate16x16.mdl"
|
||||
|
Loading…
Reference in New Issue
Block a user