mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
59
gamemodes/darkrp/plugins/item_overlay.lua
Normal file
59
gamemodes/darkrp/plugins/item_overlay.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
--[[
|
||||
| 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
|
||||
Reference in New Issue
Block a user