mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
@@ -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("Interphone de faction")
|
||||
name:SizeToContents()
|
||||
|
||||
local description = container:AddRow("description")
|
||||
description:SetText("Un interphone fixe unidirectionnel verrouillé sur un canal spécifique.")
|
||||
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
|
||||
@@ -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
|
||||
@@ -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
|
||||
54
gamemodes/darkrp/plugins/intercoms/sh_plugin.lua
Normal file
54
gamemodes/darkrp/plugins/intercoms/sh_plugin.lua
Normal 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("Changer le canal d'interphone", "Entrez un canal valide pour basculer vers", function(channelID)
|
||||
if (!channelID or channelID == "") then return end
|
||||
channelID = string.lower(channelID)
|
||||
|
||||
local channel = ix.radio.channels[channelID]
|
||||
if (!channel) then
|
||||
client:Notify("Ce n'est pas un canal valide!")
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
entity:SetChannel(channelID)
|
||||
client:Notify("Modification du canal d'interphone : " .. channelID)
|
||||
end, "")
|
||||
end
|
||||
})
|
||||
48
gamemodes/darkrp/plugins/intercoms/sv_hooks.lua
Normal file
48
gamemodes/darkrp/plugins/intercoms/sv_hooks.lua
Normal 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
|
||||
Reference in New Issue
Block a user