mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 05:43:46 +03:00
Upload
This commit is contained in:
87
gamemodes/darkrp/plugins/combinemonitors/cl_plugin.lua
Normal file
87
gamemodes/darkrp/plugins/combinemonitors/cl_plugin.lua
Normal file
@@ -0,0 +1,87 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.broadcastWords = {}
|
||||
PLUGIN.timeNeeded = 0
|
||||
PLUGIN.newString = ""
|
||||
PLUGIN.currentWord = 0
|
||||
PLUGIN.currentLine = {}
|
||||
PLUGIN.lineAmount = 0
|
||||
|
||||
PLUGIN.broadcastWordsTV = {}
|
||||
PLUGIN.timeNeededTV = 0
|
||||
PLUGIN.newStringTV = ""
|
||||
PLUGIN.currentWordTV = 0
|
||||
PLUGIN.currentLineTV = {}
|
||||
PLUGIN.lineAmountTV = 0
|
||||
|
||||
function PLUGIN:MessageReceived(client, info)
|
||||
if istable(info) and info.chatType and (info.chatType == "broadcast" or info.chatType == "dispatch" or (info.chatType == "worlddispatch" and !timer.Exists("CombineMonitorsText"))) then
|
||||
local definers = {"TV", ""}
|
||||
for _, v in pairs(definers) do
|
||||
if (info.chatType == "worlddispatch" and !timer.Exists("CombineMonitorsText"..v)) then
|
||||
if !table.IsEmpty(PLUGIN["broadcastWords"..v]) then return end
|
||||
end
|
||||
|
||||
self:ResetTextOnMonitor(v)
|
||||
|
||||
for w in info.text:gmatch("%S+") do
|
||||
table.insert(PLUGIN["broadcastWords"..v], w)
|
||||
PLUGIN["timeNeeded"..v] = PLUGIN["timeNeeded"..v] + (string.len(w) / 10)
|
||||
end
|
||||
|
||||
timer.Create("CombineMonitorsText"..v, 1, 0, function()
|
||||
PLUGIN["currentWord"..v] = math.Clamp(PLUGIN["currentWord"..v] + 1, 0, #PLUGIN["broadcastWords"..v] + 1)
|
||||
timer.Adjust("CombineMonitorsText"..v, (string.len(PLUGIN["broadcastWords"..v][PLUGIN["currentWord"..v]] or "") / 10), nil, nil)
|
||||
PLUGIN["newString"..v] = PLUGIN["newString"..v].." "..(PLUGIN["broadcastWords"..v][PLUGIN["currentWord"..v]] or "")
|
||||
|
||||
PLUGIN["currentLine"..v][#PLUGIN["currentLine"..v] + 1] = PLUGIN["broadcastWords"..v][PLUGIN["currentWord"..v]] or ""
|
||||
|
||||
local line = ""
|
||||
for i = 1, #PLUGIN["currentLine"..v] do
|
||||
line = line.." "..PLUGIN["currentLine"..v][i]
|
||||
surface.SetFont("CombineMonitor")
|
||||
local tW, _ = surface.GetTextSize(line)
|
||||
|
||||
if tW > (v == "TV" and 360 or 200) then
|
||||
PLUGIN["newString"..v] = PLUGIN["newString"..v]..string.char(10)
|
||||
PLUGIN["currentLine"..v] = {}
|
||||
PLUGIN["lineAmount"..v] = PLUGIN["lineAmount"..v] + 1
|
||||
end
|
||||
end
|
||||
|
||||
if PLUGIN["lineAmount"..v] >= (v == "TV" and 4 or 11) then
|
||||
PLUGIN["newString"..v] = ""
|
||||
PLUGIN["lineAmount"..v] = 0
|
||||
end
|
||||
|
||||
if PLUGIN["currentWord"..v] >= #PLUGIN["broadcastWords"..v] + 1 then
|
||||
timer.Remove("CombineMonitorsText"..v)
|
||||
timer.Simple(5, function()
|
||||
if timer.Exists("CombineMonitorsText"..v) then return end
|
||||
self:ResetTextOnMonitor(v)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:ResetTextOnMonitor(v)
|
||||
PLUGIN["broadcastWords"..v] = {}
|
||||
PLUGIN["timeNeeded"..v] = 0
|
||||
PLUGIN["newString"..v] = ""
|
||||
PLUGIN["currentWord"..v] = 0
|
||||
PLUGIN["currentLine"..v] = {}
|
||||
PLUGIN["lineAmount"..v] = 0
|
||||
end
|
||||
@@ -0,0 +1,127 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
include('shared.lua')
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
local overlayMaterial = ix.util.GetMaterial("models/wn/combine_binocoverlay")
|
||||
local effect = ix.util.GetMaterial("models/wn/combine_monitorbg")
|
||||
local effectTV = ix.util.GetMaterial("models/wn/combine_monitorbg_tv")
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
|
||||
if self.tv then
|
||||
if !self:GetEnabled(false) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local smallScale = 0.3
|
||||
local tvScale = 0.1
|
||||
|
||||
local position = self:GetPos()
|
||||
local angles = self:GetAngles()
|
||||
angles:RotateAroundAxis(angles:Up(), 90)
|
||||
angles:RotateAroundAxis(angles:Forward(), 90)
|
||||
|
||||
local visorColor = !isstring(GetNetVar("visorColor")) and Color(0, 112, 255, 255) or Schema.colors[GetNetVar("visorColor")]
|
||||
local visorText = !isstring(GetNetVar("visorText")) and "SOCIO-STABILITÉ" or GetNetVar("visorText")
|
||||
local visorTextNoSocio = string.Replace(visorText, "SOCIO-STABILITÉ", "")
|
||||
local workshiftStatus = !isbool(GetNetVar("WorkshiftStarted")) and false or GetNetVar("WorkshiftStarted")
|
||||
|
||||
local f, r, u = self:GetForward(), self:GetRight(), self:GetUp()
|
||||
local w, h = self.tv and 145 or 94, self.tv and 130 or 183
|
||||
local alpha = 191 + 64 * math.sin( CurTime() * 4 )
|
||||
|
||||
local trueR = r*-(-45.55) * (self.small and smallScale or self.tv and tvScale * 2 or 1)
|
||||
local thisForward = f*54.95 * (self.small and smallScale or self.tv and tvScale or 1)
|
||||
local trueU = u*90.40 * (self.small and smallScale or self.tv and tvScale * 0.75 or 1)
|
||||
|
||||
-- Red background
|
||||
cam.Start3D2D(position + thisForward + trueR + trueU, angles, 1 * (self.small and smallScale or self.tv and tvScale or 1))
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( self.tv and effectTV or effect )
|
||||
surface.DrawTexturedRect( 0, 0, w, h )
|
||||
cam.End3D2D()
|
||||
|
||||
local forward = f*55.3 * (self.small and smallScale or self.tv and tvScale or 1)
|
||||
-- Combine overlay / broadcast darkening
|
||||
cam.Start3D2D(position + forward + trueR + trueU, angles, 1 * (self.small and smallScale or self.tv and tvScale or 1))
|
||||
surface.SetDrawColor( 255, 255, 255, 255 )
|
||||
surface.SetMaterial( overlayMaterial )
|
||||
surface.DrawTexturedRect( 0, 0, w, h )
|
||||
|
||||
-- Broadcast darkening
|
||||
surface.SetDrawColor(0, 0, 0, 150)
|
||||
surface.DrawRect(0, h - (self.tv and 51 or 89), w, (self.tv and 51 or 89))
|
||||
cam.End3D2D()
|
||||
|
||||
local thisU = u*55.40 * (self.small and smallScale or self.tv and tvScale * 0.85 or 1)
|
||||
-- Status headlines and rects
|
||||
cam.Start3D2D(position + forward + trueR + thisU, angles, 0.25 * (self.small and smallScale or self.tv and tvScale or 1))
|
||||
local widthBox = (w * 4) - 45
|
||||
draw.DrawText( "SOCIO-STABILITÉ", "CombineMonitorLarge", w / 2 - (self.tv and 50 or 25), -30, Color( 255, 255, 255, alpha ), TEXT_ALIGN_LEFT )
|
||||
|
||||
local alpha2 = 35 + 10 * math.sin( CurTime() * 4 )
|
||||
surface.SetDrawColor( ColorAlpha(visorColor, alpha2) )
|
||||
surface.DrawRect( 23, 20, widthBox, h / (self.tv and 3 or 4) )
|
||||
|
||||
draw.DrawText( "SESSION DE TRAVAIL", "CombineMonitorLarge", w / 2 - (self.tv and 50 or 25), 80, Color( 255, 255, 255, alpha ), TEXT_ALIGN_LEFT )
|
||||
surface.SetDrawColor( ColorAlpha((!workshiftStatus and Color(150, 150, 150) or Color(99, 183, 83)), alpha2) )
|
||||
surface.DrawRect( 23, 20 + 156 - 48, widthBox, h / (self.tv and 3 or 4) )
|
||||
cam.End3D2D()
|
||||
|
||||
-- Status text
|
||||
-- Do not render this part if there's a halo being drawn in the entity, as this will literally
|
||||
-- cause epileptic seizures
|
||||
|
||||
local thisR = r*-(-39.8) * (self.small and smallScale or self.tv and tvScale * 2.145 or 1)
|
||||
if (halo.RenderedEntity() != self) then
|
||||
cam.Start3D2D(position + forward + thisR + thisU, angles, 0.25 * (self.small and smallScale or self.tv and tvScale or 1))
|
||||
PLUGIN.clip:Scissor2D(widthBox, h * 2)
|
||||
local text = visorTextNoSocio.." /// "
|
||||
local text2 = (!workshiftStatus and "SESSION DE TRAVAIL INACTIVE" or "SESSION DE TRAVAIL ACTIVE").." /// "
|
||||
surface.SetFont("VisorScrolling")
|
||||
|
||||
local textw, _ = surface.GetTextSize(text)
|
||||
local textw2, _ = surface.GetTextSize(text2)
|
||||
surface.SetTextColor(ColorAlpha(color_white, alpha))
|
||||
|
||||
local x = RealTime() * 150 % textw * -1
|
||||
local x2 = RealTime() * 150 % textw2 * -1
|
||||
while (x < widthBox) do
|
||||
surface.SetTextPos(x, 25)
|
||||
surface.DrawText(text)
|
||||
x = x + textw
|
||||
end
|
||||
|
||||
while (x2 < widthBox) do
|
||||
surface.SetTextPos(x2, 182 - 48)
|
||||
surface.DrawText(text2)
|
||||
x2 = x2 + textw2
|
||||
end
|
||||
|
||||
PLUGIN.clip()
|
||||
cam.End3D2D()
|
||||
|
||||
local thisR2 = r*-(-52.15) * (self.small and smallScale or self.tv and tvScale * 2 or 1)
|
||||
local thisU2 = u * 9.75 * (self.small and smallScale or self.tv and tvScale * 0.30 or 1)
|
||||
-- Broadcast text
|
||||
cam.Start3D2D(position + forward + thisR2 + thisU2, angles, 0.25 * (self.small and smallScale or self.tv and tvScale or 1))
|
||||
PLUGIN.clip:Scissor2D(w * 4.3, h * 2)
|
||||
draw.DrawText( "DIFFUSION", "CombineMonitorLarge", w / 2, 5, Color( 255, 255, 255, alpha ), TEXT_ALIGN_LEFT )
|
||||
draw.DrawText( (self.tv and PLUGIN.newStringTV or PLUGIN.newString), "CombineMonitor", w / 2 - 10, 70, Color( 255, 255, 255, alpha ), TEXT_ALIGN_LEFT )
|
||||
PLUGIN.clip()
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
AddCSLuaFile("cl_init.lua") -- Make sure clientside
|
||||
AddCSLuaFile("shared.lua") -- and shared scripts are sent.
|
||||
|
||||
include('shared.lua')
|
||||
|
||||
function ENT:SpawnFunction(ply, tr)
|
||||
if !tr.Hit then return end
|
||||
|
||||
local SpawnPos = tr.HitPos + tr.HitNormal * 16
|
||||
local ent = ents.Create(self.ClassName)
|
||||
ent:SetPos(SpawnPos)
|
||||
ent:Spawn()
|
||||
ent:Activate()
|
||||
|
||||
ix.saveEnts:SaveEntity(ent)
|
||||
|
||||
return ent
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
local path = "models/fruity/new_combine_monitor2"
|
||||
self:SetModel(self.tv and "models/props_c17/tv_monitor01.mdl" or !self.small and path..".mdl" or path.."_small.mdl")
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
|
||||
local physics = self:GetPhysicsObject()
|
||||
|
||||
if (physics and IsValid(physics)) then
|
||||
physics:EnableMotion(false)
|
||||
physics:Wake()
|
||||
end
|
||||
|
||||
if (self.OnInitialize) then
|
||||
self:OnInitialize()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Écran Géant"
|
||||
ENT.Author = "Fruity"
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = "Fruitybooty"
|
||||
|
||||
ENT.Category = "HL2 RP"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
@@ -0,0 +1,12 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
include('shared.lua')
|
||||
@@ -0,0 +1,16 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
|
||||
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
|
||||
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
|
||||
|
||||
include('shared.lua')
|
||||
@@ -0,0 +1,28 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "ix_combinemonitor"
|
||||
|
||||
ENT.PrintName = "Écran"
|
||||
ENT.Author = "Fruity"
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = "Fruitybooty"
|
||||
|
||||
ENT.small = true
|
||||
|
||||
ENT.Category = "HL2 RP"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
@@ -0,0 +1,12 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
include('shared.lua')
|
||||
@@ -0,0 +1,43 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
|
||||
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
|
||||
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
|
||||
|
||||
include('shared.lua')
|
||||
|
||||
function ENT:Use(client)
|
||||
if client.CantPlace then
|
||||
client:NotifyLocalized("Vous devez attendre avant de pouvoir réutiliser cela !")
|
||||
return false
|
||||
end
|
||||
|
||||
client.CantPlace = true
|
||||
|
||||
timer.Simple(3, function()
|
||||
if client then
|
||||
client.CantPlace = false
|
||||
end
|
||||
end)
|
||||
|
||||
if self:GetEnabled() then
|
||||
self:SetEnabled(false)
|
||||
else
|
||||
self:SetEnabled(true)
|
||||
end
|
||||
|
||||
self:EmitSound("buttons/button18.wav")
|
||||
end
|
||||
|
||||
function ENT:OnInitialize()
|
||||
self:SetEnabled(true)
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "ix_combinemonitor"
|
||||
|
||||
ENT.PrintName = "Télévision de l'Union"
|
||||
ENT.Author = "Fruity"
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = "Fruitybooty"
|
||||
|
||||
ENT.tv = true
|
||||
|
||||
ENT.Category = "HL2 RP"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Bool", 1, "Enabled")
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
ITEM.name = "Télévision"
|
||||
ITEM.model = "models/props_c17/tv_monitor01.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
|
||||
ITEM.description = "La petite télévision est dotée d'un écran plat d'environ 15 pouces et est équipée d'un tuner analogique pour capter la chaîne locale. Elle possède également une petite antenne télescopique pour améliorer la réception du signal. Le boîtier est en plastique noir brillant et il y a un bouton d'alimentation sur le côté."
|
||||
|
||||
ITEM.description = "Cet écran rectangulaire trône au centre de la pièce, captivant l'attention de tous avec ses images lumineuses et ses sons captivants."
|
||||
|
||||
ITEM.category = "Autres"
|
||||
|
||||
ITEM.functions.Place = {
|
||||
name = "Placer",
|
||||
OnRun = function(itemTable)
|
||||
local client = itemTable.player
|
||||
local entity = ents.Create("ix_combinemonitor_tv")
|
||||
local trace = client:GetEyeTraceNoCursor()
|
||||
|
||||
if (trace.HitPos:Distance( client:GetShootPos() ) <= 192) and !client.CantPlace then
|
||||
entity:SetPos(trace.HitPos + Vector( 0, 0, 8 ))
|
||||
entity:Spawn()
|
||||
entity:SetNWInt("owner", client:GetCharacter():GetID())
|
||||
|
||||
client.CantPlace = true
|
||||
|
||||
ix.saveEnts:SaveEntity(entity)
|
||||
|
||||
timer.Simple(3, function()
|
||||
if client then
|
||||
client.CantPlace = false
|
||||
end
|
||||
end)
|
||||
elseif client.CantPlace then
|
||||
client:NotifyLocalized("Vous ne pouvez pas placer ça maintenant !")
|
||||
return false
|
||||
else
|
||||
client:NotifyLocalized("Vous ne pouvez pas le placer aussi loin !")
|
||||
return false
|
||||
end
|
||||
end
|
||||
}
|
||||
105
gamemodes/darkrp/plugins/combinemonitors/sh_3d2d_clipping.lua
Normal file
105
gamemodes/darkrp/plugins/combinemonitors/sh_3d2d_clipping.lua
Normal file
@@ -0,0 +1,105 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
AddCSLuaFile()
|
||||
if SERVER then return end
|
||||
|
||||
local render = render
|
||||
local Vector = Vector
|
||||
local STENCIL_ALWAYS = STENCIL_ALWAYS
|
||||
local STENCIL_KEEP = STENCIL_KEEP
|
||||
local STENCIL_REPLACE = STENCIL_REPLACE
|
||||
local STENCIL_EQUAL = STENCIL_EQUAL
|
||||
local MATERIAL_CULLMODE_CW = MATERIAL_CULLMODE_CW
|
||||
local MATERIAL_CULLMODE_CCW = MATERIAL_CULLMODE_CCW
|
||||
|
||||
local transparent = Color(0, 0, 0, 0)
|
||||
local clipping = false
|
||||
|
||||
local clip = {}
|
||||
setmetatable(clip, {
|
||||
__call = function()
|
||||
if clipping then
|
||||
clipping = false
|
||||
render.SetStencilEnable(false)
|
||||
end
|
||||
end
|
||||
})
|
||||
setfenv(1, clip)
|
||||
|
||||
local stencil do
|
||||
local stenciling = false
|
||||
function stencil()
|
||||
if stenciling then
|
||||
render.SetStencilCompareFunction(STENCIL_EQUAL)
|
||||
stenciling = false
|
||||
return
|
||||
end
|
||||
|
||||
render.SetStencilWriteMask(0xFF)
|
||||
render.SetStencilTestMask(0xFF)
|
||||
render.SetStencilReferenceValue(0)
|
||||
render.SetStencilCompareFunction(STENCIL_ALWAYS)
|
||||
render.SetStencilPassOperation(STENCIL_KEEP)
|
||||
render.SetStencilFailOperation(STENCIL_KEEP)
|
||||
render.SetStencilZFailOperation(STENCIL_KEEP)
|
||||
render.ClearStencil()
|
||||
|
||||
render.SetStencilEnable(true)
|
||||
render.SetStencilReferenceValue(1)
|
||||
|
||||
render.SetStencilCompareFunction(STENCIL_ALWAYS)
|
||||
render.SetStencilPassOperation(STENCIL_REPLACE)
|
||||
|
||||
stenciling = true
|
||||
end end
|
||||
|
||||
do
|
||||
local vert1, vert2, vert3, vert4 = Vector(), Vector(), Vector(), Vector()
|
||||
function clip:Scissor2D(w, h)
|
||||
clip()
|
||||
|
||||
vert2[2] = h
|
||||
|
||||
vert3[1] = w
|
||||
vert3[2] = h
|
||||
|
||||
vert4[1] = w
|
||||
|
||||
stencil()
|
||||
|
||||
render.CullMode(MATERIAL_CULLMODE_CW)
|
||||
render.SetColorMaterial()
|
||||
render.DrawQuad(vert1, vert2, vert3, vert4, transparent)
|
||||
render.CullMode(MATERIAL_CULLMODE_CCW)
|
||||
|
||||
stencil()
|
||||
|
||||
clipping = true
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
function clip:Scissor3D(pos, ang, mins, maxs)
|
||||
clip()
|
||||
|
||||
stencil()
|
||||
|
||||
render.SetColorMaterial()
|
||||
render.DrawBox(pos, ang, mins, maxs, transparent, true)
|
||||
|
||||
stencil()
|
||||
|
||||
clipping = true
|
||||
end
|
||||
end
|
||||
|
||||
return clip
|
||||
20
gamemodes/darkrp/plugins/combinemonitors/sh_plugin.lua
Normal file
20
gamemodes/darkrp/plugins/combinemonitors/sh_plugin.lua
Normal file
@@ -0,0 +1,20 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Ecran Combine"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "Des écrans pour indiquer le socio-statut de la Cité, utile pour les diffusions et l'état des sessions de travails."
|
||||
|
||||
PLUGIN.clip = ix.util.Include("sh_3d2d_clipping.lua")
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
ix.util.Include("cl_plugin.lua")
|
||||
73
gamemodes/darkrp/plugins/combinemonitors/sv_plugin.lua
Normal file
73
gamemodes/darkrp/plugins/combinemonitors/sv_plugin.lua
Normal file
@@ -0,0 +1,73 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PLUGIN:RegisterSaveEnts()
|
||||
ix.saveEnts:RegisterEntity("ix_combinemonitor", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
return {pos = data.pos, angles = data.angles, motion = false}
|
||||
end,
|
||||
})
|
||||
|
||||
ix.saveEnts:RegisterEntity("ix_combinemonitor_small", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
return {pos = data.pos, angles = data.angles, motion = false}
|
||||
end,
|
||||
})
|
||||
|
||||
ix.saveEnts:RegisterEntity("ix_combinemonitor_tv", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
return {pos = data.pos, angles = data.angles, motion = false, owner = entity:GetNWInt("owner")}
|
||||
end,
|
||||
OnRestore = function(entity, data)
|
||||
entity:SetNWInt("owner", data.owner)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerMessageSend(speaker, chatType)
|
||||
if chatType == "broadcast" or chatType == "dispatch" then
|
||||
for _, ent in pairs(ents.GetAll()) do
|
||||
if ent:GetClass() != "ix_combinemonitor" and ent:GetClass() != "ix_combinemonitor_small" then continue end
|
||||
ent:EmitSound("ambience/3d-sounds/alarms/alarm4.ogg", 90)
|
||||
ent:EmitSound("npc/overwatch/radiovoice/attention.wav", 70)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:PlayerButtonDown( client, key )
|
||||
if IsFirstTimePredicted() then
|
||||
if key == KEY_LALT then
|
||||
local entity = client:GetEyeTraceNoCursor().Entity
|
||||
|
||||
if !IsValid(entity) then
|
||||
return false
|
||||
end
|
||||
|
||||
if (client:GetShootPos():Distance(entity:GetPos()) > 100) then
|
||||
return false
|
||||
end
|
||||
|
||||
if entity:GetNWInt("owner") and client:GetCharacter():GetID() != entity:GetNWInt("owner") then
|
||||
return false
|
||||
end
|
||||
|
||||
if (entity:GetClass() == "ix_combinemonitor_tv") then
|
||||
local pos = entity:GetPos()
|
||||
|
||||
ix.item.Spawn("television", pos + Vector( 0, 0, 2 ), nil, entity:GetAngles())
|
||||
|
||||
entity:Remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user