Files
wnsrc/gamemodes/darkrp/plugins/item_overlay.lua
lifestorm df294d03aa Upload
2024-08-04 23:54:45 +03:00

60 lines
1.6 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

--[[
| 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/
--]]
PLUGIN.name = "Item Overlay"
PLUGIN.description = "Allows items to to create overlays on players' screens."
PLUGIN.author = "DrodA"
ix.option.Add("enableOverlay", ix.type.bool, true, {category = "Appearance"})
ix.option.Add("overlayAlpha", ix.type.number, 1, {category = "Appearance", min = 0.1, max = 1, decimals = 1})
ix.lang.AddTable("english", {
optEnableOverlay = "Eşya Overlayini Etkinleştir",
optdEnableOverlay = "Eşyalar ekranında bir overlay çıkarabilir mi?",
optOverlayAlpha = "Overlay Opaklığı",
optdOverlayAlpha = "Overlay'in opaklığını ayarlar."
})
if (SERVER) then return end
function PLUGIN:ItemHasOverlay(client)
local overlay = false
if (!client:GetCharacter()) then return end
for _, item in pairs(client:GetItems()) do
if (!item.overlay or !item:GetData("equip")) then continue end
overlay = ix.util.GetMaterial(item.overlay)
break
end
return overlay
end
function PLUGIN:RenderScreenspaceEffects()
local frametime = FrameTime()
local client = LocalPlayer()
if (!IsValid(client) or !client:GetCharacter()) then return end
local overlay = self:ItemHasOverlay(client)
if (!overlay or !ix.option.Get("enableOverlay")) then return end
render.UpdateScreenEffectTexture()
overlay:SetFloat("$alpha", 1 * ix.option.Get("overlayAlpha"))
overlay:SetInt("$ignorez", 1)
render.SetMaterial(overlay)
render.DrawScreenQuad()
end