This commit is contained in:
lifestorm
2024-08-05 18:40:29 +03:00
parent 9f505a0646
commit c6d9b6f580
8044 changed files with 1853472 additions and 21 deletions

View 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

View File

@@ -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-STABILIZATION INTACT" or GetNetVar("visorText")
local visorTextNoSocio = string.Replace(visorText, "SOCIO-STABILIZATION", "")
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-STABILIZATION", "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( "WORKSHIFT STATUS", "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 "WORKSHIFT INACTIVE" or "WORKSHIFT 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( "BROADCASTS", "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

View File

@@ -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

View File

@@ -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 = "Combine Monitor"
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

View File

@@ -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')

View File

@@ -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')

View File

@@ -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 = "Combine Monitor Small"
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

View File

@@ -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')

View File

@@ -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("You need to wait before you can use this!")
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

View File

@@ -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 = "Combine Monitor TV"
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

View File

@@ -0,0 +1,49 @@
--[[
| 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 = "Television"
ITEM.model = "models/props_c17/tv_monitor01.mdl"
ITEM.width = 1
ITEM.height = 1
ITEM.description = "A regime issued television to view propaganda broadcasts on."
ITEM.category = "misc"
ITEM.functions.Place = {
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("You cannot place this right now!")
return false
else
client:NotifyLocalized("You cannot place it that far away!..")
return false
end
end
}

View 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

View 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 = "Combine Monitors"
PLUGIN.author = "Fruity"
PLUGIN.description = "Screens to state the status of the City. A helpful info terminal for broadcasts and city-state which helps citizens know what the CPs are currently doing and what the sociostability is, work cycle status and all that."
PLUGIN.clip = ix.util.Include("sh_3d2d_clipping.lua")
ix.util.Include("sv_plugin.lua")
ix.util.Include("cl_plugin.lua")

View 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("ambient/alarms/warningbell1.wav", 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