This commit is contained in:
lifestorm
2024-08-04 23:12:27 +03:00
parent 0e770b2b49
commit ba1fc01b16
7084 changed files with 2173495 additions and 14 deletions

View File

@@ -0,0 +1,48 @@
--[[
| 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")
ENT.PopulateEntityInfo = true
local glowMaterial = Material("sprites/glow04_noz")
function ENT:OnPopulateEntityInfo(container)
local name = container:AddRow("name")
name:SetImportant()
name:SetText("Faction Intercom")
name:SizeToContents()
local description = container:AddRow("description")
description:SetText("A one-way stationary intercom locked to a specific channel.")
description:SizeToContents()
local channelID = self:GetChannel() or ""
local channel = ix.radio.channels[channelID]
if (!channel) then return end
local channelRow = container:AddRow("channel")
channelRow:SetText("Channel: " .. string.upper(channelID))
channelRow:SetBackgroundColor(channel.color)
channelRow:SizeToContents()
end
function ENT:Draw()
self:DrawModel()
local channelID = self:GetChannel() or ""
local channel = ix.radio.channels[channelID]
if (!channel) then return end
render.SetMaterial(glowMaterial)
render.DrawSprite(self:GetPos() + self:GetUp() * 2.6 + self:GetRight() * 2.3 + self:GetForward() * -3.1, 3, 3, channel.color)
end

View File

@@ -0,0 +1,30 @@
--[[
| 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")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function ENT:Initialize()
self:SetModel("models/props/cs_office/phone_p1.mdl")
self:SetMoveType(MOVETYPE_VPHYSICS)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
local physicsObject = self:GetPhysicsObject()
if (IsValid(physicsObject)) then
physicsObject:Wake()
physicsObject:EnableMotion(false)
end
end

View File

@@ -0,0 +1,23 @@
--[[
| 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/
--]]
DEFINE_BASECLASS("base_gmodentity")
ENT.Type = "anim"
ENT.Author = "Aspect™"
ENT.PrintName = "Faction Intercom"
ENT.Category = "HL2 RP"
ENT.Spawnable = true
ENT.AdminSpawnable = true
function ENT:SetupDataTables()
self:NetworkVar("String", 0, "Channel")
end

View File

@@ -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/
--]]
PLUGIN.name = "Faction Intercoms"
PLUGIN.author = "Aspect™"
PLUGIN.description = "Adds faction intercoms."
ix.util.Include("sv_hooks.lua")
properties.Add("ixChangeIntercomChannel", {
MenuLabel = "Change Channel",
Order = 405,
MenuIcon = "icon16/cog_edit.png",
Filter = function(self, entity, client)
if (entity:GetClass() == "ix_intercom" and CAMI.PlayerHasAccess(client, "Helix - Basic Admin Commands", nil)) then return true end
end,
Action = function(self, entity)
self:MsgStart()
net.WriteEntity(entity)
self:MsgEnd()
end,
Receive = function(self, length, client)
local entity = net.ReadEntity()
if (!IsValid(entity)) then return end
if (!self:Filter(entity, client)) then return end
client:RequestString("Change Intercom Channel", "Enter a valid channel to switch to", function(channelID)
if (!channelID or channelID == "") then return end
channelID = string.lower(channelID)
local channel = ix.radio.channels[channelID]
if (!channel) then
client:Notify("That is not a valid channel!")
return
end
entity:SetChannel(channelID)
client:Notify("Changed intercom channel to: " .. channelID)
end, "")
end
})

View File

@@ -0,0 +1,48 @@
--[[
| 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/
--]]
function PLUGIN:PostPlayerSay(client, chatType, message, anonymous)
local entity = client:GetEyeTraceNoCursor().Entity
if (entity:GetClass() != "ix_intercom") then return end
if (entity:GetPos():DistToSqr(client:GetPos()) > 9000) then return end
local channelID = entity:GetChannel()
if (!channelID or channelID == "") then return end
local channel = ix.radio.channels[channelID]
if (!channel) then return end
local listeners = table.Copy(channel.listeners)
local radioType = ix.radio.types.talk
if (chatType == "w") then
radioType = ix.radio.types.whisper
elseif (chatType == "y") then
radioType = ix.radio.types.yell
end
listeners[#listeners + 1] = client
client:EmitSound("willardnetworks/radio/handheld/handheld" .. math.random(1, 4) .. ".wav")
ix.chat.Send(client, "radio", message, false, listeners, {channel = channelID, radioType = radioType})
end
function PLUGIN:RegisterSaveEnts()
ix.saveEnts:RegisterEntity("ix_intercom", true, true, true, {
OnSave = function(entity, data)
data.channel = entity:GetChannel() or ""
end,
OnRestore = function(entity, data)
entity:SetChannel(data.channel or "")
end
})
end