This commit is contained in:
lifestorm
2024-08-04 23:12:27 +03:00
parent 8064ba84d8
commit 9c918c46e5
7081 changed files with 2173485 additions and 14 deletions

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/
--]]
-- some cool glowing code is taken from open-source LVS base originally used
-- for shield impacting
function EFFECT:Init( data )
self.ent = data:GetEntity()
self.lt = data:GetScale()
self.dt = CurTime() + self.lt
if IsValid( self.ent ) then
self.model = ClientsideModel( self.ent:GetModel(), RENDERMODE_TRANSCOLOR )
self.model:SetMaterial("models/alyx/emptool_glow")
self.model:SetColor( Color(255, 223, 136) )
self.model:SetParent( self.ent, 0 )
self.model:SetMoveType( MOVETYPE_NONE )
self.model:SetLocalPos( Vector( 0, 0, 0 ) )
self.model:SetLocalAngles( Angle( 0, 0, 0 ) )
self.model:AddEffects( EF_BONEMERGE )
end
end
function EFFECT:Think()
if not IsValid( self.ent ) and IsValid(self.model) then
self.model:Remove()
end
if self.dt < CurTime() then
if IsValid( self.model ) then
self.model:Remove()
end
return false
end
return true
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,66 @@
--[[
| 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 smoke = {
"particle/smokesprites_0001",
"particle/smokesprites_0002",
"particle/smokesprites_0003",
"particle/smokesprites_0004",
"particle/smokesprites_0005",
"particle/smokesprites_0006",
"particle/smokesprites_0007",
"particle/smokesprites_0008",
"particle/smokesprites_0009",
"particle/smokesprites_0010",
"particle/smokesprites_0011",
"particle/smokesprites_0012",
"particle/smokesprites_0013",
"particle/smokesprites_0014",
"particle/smokesprites_0015",
"particle/smokesprites_0016"
}
function EFFECT:Init( data )
self.pos = data:GetOrigin()
local emitter = ParticleEmitter( self.pos, false )
for i = 1, 40 do
local Pos = Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), 2)
local particle = emitter:Add( smoke[math.random(1, #smoke)], self.pos + Pos * 2 )
if ( particle ) then
particle:SetVelocity( Pos * 1.35 )
particle:SetLifeTime( 0 )
particle:SetDieTime( 3 )
particle:SetStartAlpha( 255 )
particle:SetEndAlpha( 0 )
particle:SetColor(255, 223, 136)
particle:SetRoll( math.Rand( -1, 1 ) )
local Size = math.random( 8, 10 )
particle:SetStartSize( Size )
particle:SetEndSize( Size )
particle:SetAirResistance( 50 )
particle:SetGravity( Vector( math.Rand( -1, 1 ) * 4, math.Rand( -1, 1 ) * 4, 0.5 ) )
end
end
emitter:Finish()
end
function EFFECT:Think()
return false
end
function EFFECT:Render()
end

View File

@@ -0,0 +1,44 @@
--[[
| 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.RenderGroup = RENDERGROUP_TRANSLUCENT
local glowMaterial = Material("sprites/glow04_noz")
function ENT:DrawTranslucent()
self:DrawModel()
local spritePos = self:GetPos() + self:GetUp() * 50.5 + self:GetRight() * 16.3 + self:GetForward() * 7.8
if (!self.hideSprite) then
render.SetMaterial(glowMaterial)
render.DrawSprite(spritePos, 2.5, 2.5, Color(255, 0, 0))
end
if (imgui.Entity3D2D(self, Vector(7.3, -18, 52.5), Angle(0, 90, 90), 0.01)) then -- I didn't wanna fuck with button positions
if (imgui.xButton(0, 0, 350, 350, 0, Color(255, 255, 255, 255), Color(255, 255, 255, 255), Color(255, 255, 255, 255))) then
if (LocalPlayer():EyePos():DistToSqr(spritePos) > 3000) then imgui.End3D2D() return end
self.hideSprite = true
net.Start("ixBatteryChargerUse")
net.WriteEntity(self)
net.SendToServer()
timer.Simple(0.1, function()
self.hideSprite = false
end)
end
imgui.End3D2D()
end
end

View File

@@ -0,0 +1,251 @@
--[[
| 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")
util.AddNetworkString("ixBatteryChargerUse")
local PLUGIN = PLUGIN
function ENT:Initialize()
self:SetModel("models/willardnetworks/gearsofindustry/wn_machinery_01.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetTrigger(true)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
function ENT:OnCharge(client)
if (client:EyePos():DistToSqr(self:GetPos()) > 10000) then return end
self:EmitSound("buttons/lightswitch2.wav", 75, 80)
if (!self.attachedBattery or !self.attachedBattery:IsValid() or self.charging) then return end
local selfPos, up, right, forward = self:GetPos(), self:GetUp(), self:GetRight(), self:GetForward()
local boxMin, boxMax = selfPos + up * 45 + right * 13 + forward * -7, selfPos + up * 55 + right * -10 + forward * 7
for _, entity in ipairs(ents.FindInBox(boxMin, boxMax)) do
if (entity:GetClass() != "ix_item") then continue end
self.attachedItem = entity
break
end
if (!self.attachedItem or !self.attachedItem:IsValid()) then return end
self.charging = true
self.attachedItem.inUse = true
self.attachedBattery.inUse = true
self:ResetSequence("Working")
local zap1 = ents.Create("point_tesla")
zap1:SetParent(self)
zap1:SetKeyValue("m_SoundName" ,"DoSpark")
zap1:SetKeyValue("texture" ,"sprites/physbeam.vmt")
zap1:SetKeyValue("m_Color" ,"255 255 164")
zap1:SetKeyValue("m_flRadius" , "1")
zap1:SetKeyValue("beamcount_min" ,"4")
zap1:SetKeyValue("beamcount_max", "6")
zap1:SetKeyValue("thick_min", ".5")
zap1:SetKeyValue("thick_max", "2")
zap1:SetKeyValue("lifetime_min" ,".1")
zap1:SetKeyValue("lifetime_max", ".5")
zap1:SetKeyValue("interval_min", "0.1")
zap1:SetKeyValue("interval_max" ,"1")
zap1:SetPos(self:GetPos() + self:GetUp() * 53 + self:GetRight() * 8)
zap1:Spawn()
zap1:Fire("DoSpark", "", 0.1)
zap1:Fire("DoSpark", "", 0.4)
zap1:Fire("DoSpark", "", 1.7)
zap1:Fire("DoSpark", "", 2.5)
zap1:Fire("DoSpark", "", 2.7)
zap1:Fire("kill", "", 3)
local zap2 = ents.Create("point_tesla")
zap2:SetParent(self)
zap2:SetKeyValue("m_SoundName" ,"DoSpark")
zap2:SetKeyValue("texture" ,"sprites/physbeam.vmt")
zap2:SetKeyValue("m_Color" ,"255 255 164")
zap2:SetKeyValue("m_flRadius" , "1")
zap2:SetKeyValue("beamcount_min" ,"4")
zap2:SetKeyValue("beamcount_max", "6")
zap2:SetKeyValue("thick_min", ".5")
zap2:SetKeyValue("thick_max", "2")
zap2:SetKeyValue("lifetime_min" ,".1")
zap2:SetKeyValue("lifetime_max", ".5")
zap2:SetKeyValue("interval_min", "0.1")
zap2:SetKeyValue("interval_max" ,"1")
zap2:SetPos(self:GetPos() + self:GetUp() * 53 + self:GetRight() * -4)
zap2:Spawn()
zap2:Fire("DoSpark", "", 0.1)
zap2:Fire("DoSpark", "", 0.4)
zap2:Fire("DoSpark", "", 1.7)
zap2:Fire("DoSpark", "", 2.5)
zap2:Fire("DoSpark", "", 2.7)
zap2:Fire("kill", "", 3)
local zap3 = ents.Create("point_tesla")
zap3:SetParent(self)
zap3:SetKeyValue("m_SoundName" ,"DoSpark")
zap3:SetKeyValue("texture" ,"sprites/physbeam.vmt")
zap3:SetKeyValue("m_Color" ,"255 255 164")
zap3:SetKeyValue("m_flRadius" , "0")
zap3:SetKeyValue("beamcount_min" ,"4")
zap3:SetKeyValue("beamcount_max", "6")
zap3:SetKeyValue("thick_min", ".5")
zap3:SetKeyValue("thick_max", "2")
zap3:SetKeyValue("lifetime_min" ,".1")
zap3:SetKeyValue("lifetime_max", ".5")
zap3:SetKeyValue("interval_min", "0.1")
zap3:SetKeyValue("interval_max" ,"1")
zap3:SetPos(self.attachedItem:GetPos())
zap3:Spawn()
zap3:Fire("DoSpark", "", 0.1)
zap3:Fire("DoSpark", "", 0.4)
zap3:Fire("DoSpark", "", 1.7)
zap3:Fire("DoSpark", "", 2.5)
zap3:Fire("DoSpark", "", 2.7)
zap3:Fire("kill", "", 3)
self:EmitSound("ambient/machines/combine_terminal_idle3.wav")
self:EmitSound("ambient/machines/combine_terminal_loop1.wav")
timer.Simple(1, function()
if (!self.attachedItem or !self.attachedItem:IsValid()) then
self:StopCharging()
return
end
local dissolver = ents.Create("env_entity_dissolver")
dissolver:SetKeyValue("dissolvetype", 4)
dissolver:SetKeyValue("magnitude", 0)
dissolver:SetPos(selfPos)
dissolver:Spawn()
self.attachedItem:SetName("ix_batterycharger_dissolve_target")
dissolver:Fire("Dissolve", self.attachedItem:GetName())
dissolver:Fire("Kill", "", 0)
timer.Simple(1.5, function()
local itemInstance = ix.item.instances[self.attachedBattery.ixItemID]
if (!self.attachedBattery or !self.attachedBattery:IsValid() or !itemInstance) then
self:StopCharging()
return
end
local charge = itemInstance:GetData("charge", 0) + 1
itemInstance:SetData("charge", charge)
self:EmitSound("items/suitchargeok1.wav")
self:StopSound("ambient/machines/combine_terminal_idle3.wav")
self:StopSound("ambient/machines/combine_terminal_loop1.wav")
if (charge <= 10) then
self:StopCharging()
else
self.attachedBattery.ixIsDestroying = true -- Setting this early to stop Helix from destroying the battery once it takes fire damage.
self.attachedBattery:Ignite(4, 0)
for i = 1, 15 do
timer.Simple(0.25 * i, function()
if (!self.attachedBattery or !self.attachedBattery:IsValid()) then
self.charging = false
self.attachedItem.inUse = false
self.attachedBattery.inUse = false
return
end
self.attachedBattery:SetNetVar("beeping", true)
self.attachedBattery:EmitSound("hl1/fvox/beep.wav")
if (i != 15) then
timer.Simple(0.125, function()
self.attachedBattery:SetNetVar("beeping", false)
end)
else
local batteryPos = self.attachedBattery:GetPos()
local effectData = EffectData()
effectData:SetStart(batteryPos)
effectData:SetOrigin(batteryPos)
util.Effect("cball_explode", effectData)
self.attachedBattery:EmitSound("npc/roller/mine/rmine_explode_shock1.wav")
self.attachedBattery:Remove()
self:StopCharging()
end
end)
end
end
end)
end)
end
function ENT:StopCharging(fake)
if (!fake) then
self.charging = false
end
self:StopSound("ambient/machines/combine_terminal_idle3.wav")
self:StopSound("ambient/machines/combine_terminal_loop1.wav")
if (IsValid(self.attachedItem)) then
self.attachedItem.inUse = false
end
if (IsValid(self.attachedBattery)) then
self.attachedBattery.inUse = false
end
end
function ENT:StartTouch(entity)
if (entity:GetClass() != "ix_item" or entity.attached) then return end
if (entity:GetItemID() != "combinebattery") then return end
if (self.attachedBattery and self.attachedBattery != NULL) then return end
local physObj = entity:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
entity:SetPos(self:GetPos() + self:GetUp() * 43.2 + self:GetRight() * -21.4 + self:GetForward() * 6.55)
entity:SetAngles(self:GetAngles())
entity:SetParent(self)
self.attachedBattery = entity
entity.attached = true
self:EmitSound("physics/metal/weapon_impact_soft" .. math.random(1, 3) .. ".wav")
end
net.Receive("ixBatteryChargerUse", function(_, client)
local entity = net.ReadEntity()
if (!entity or !entity:IsValid() or entity:GetClass() != "ix_batterycharger") then return end
entity:OnCharge(client)
end)

View File

@@ -0,0 +1,18 @@
--[[
| 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.PrintName = "Battery Charger"
ENT.Category = "HL2 RP"
ENT.Spawnable = true
ENT.AdminOnly = true
ENT.PhysgunDisable = true
ENT.PhysgunAllowAdmin = true

View File

@@ -0,0 +1,130 @@
--[[
| 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.RenderGroup = RENDERGROUP_TRANSLUCENT
ENT.nextClickTime = 0
function ENT:TurnOn()
net.Start("ix.terminal.turnOn")
net.WriteEntity(self)
net.SendToServer()
end
function ENT:TurnOff()
net.Start("ix.terminal.turnOff")
net.WriteEntity(self)
net.SendToServer()
end
function ENT:CreateStartScreen(client, data)
local cwuMenu = ix.factoryPanels:CreatePanel("ixCWUTerminalMenu", self)
cwuMenu:SetUsedBy(client)
cwuMenu:SetUserGenData(istable(data) and !table.IsEmpty(data) and data[1] or nil)
cwuMenu.cidCardInserted = data[1] and true or nil
cwuMenu.cwuCardInserted = data[2] and true or nil
cwuMenu.authError = data[3]
self:EmitSound("buttons/button1.wav")
end
function ENT:PurgeScreenPanels(muteSound)
ix.factoryPanels:PurgeEntityPanels(self)
if (!muteSound) then
self:EmitSound("buttons/button5.wav")
end
end
function ENT:OnRemove()
self:PurgeScreenPanels(true)
self:StopSound("wn_goi/terminal_turnon.mp3")
end
ENT.vguiLocalizedTransform = {
vec = Vector(4.53, -8.15, 44.03),
ang = Angle(0, 90, 55),
res = 0.01
}
function ENT:DrawTranslucent()
self:DrawModel()
-- main panel
vgui.Start3D2D( self:LocalToWorld(self.vguiLocalizedTransform.vec), self:LocalToWorldAngles(self.vguiLocalizedTransform.ang), self.vguiLocalizedTransform.res )
if self.terminalPanel then
self.terminalPanel:Paint3D2D()
end
vgui.End3D2D()
-- buttons
if (imgui.Entity3D2D(self, Vector(7.19, 10.16, 41.73), Angle(0, 90, 55), 0.01)) then
if (imgui.xButton(22, -315, 100, 210, 5, Color(255, 44, 44, 0), Color(255, 44, 44, 255), Color(255, 44, 44, 10))) then
if (!self.terminalPanel and self.nextClickTime < CurTime()) then
self:TurnOn()
self.nextClickTime = CurTime() + 1.5
elseif (self.terminalPanel and self.nextClickTime < CurTime()) then
self:TurnOff()
self.nextClickTime = CurTime() + 1.5
end
end
draw.SimpleText("MAJĄTEK MIASTA", "ButtonLabel", 470, 30, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if (imgui.xButton(0, 5, 150, 50, 5, Color(255, 255, 255, 0), Color(255, 255, 255, 255), Color(255, 255, 255, 10)) and self.terminalPanel and self.nextClickTime < CurTime()) then
if self.terminalPanel then
self.terminalPanel:CreateOption(string.utf8upper("city stock"))
end
self.nextClickTime = CurTime() + 1.5
end
draw.SimpleText("RYNEK", "ButtonLabel", 470, 155, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if (imgui.xButton(0, 130, 150, 50, 5, Color(255, 255, 255, 0), Color(255, 255, 255, 255), Color(255, 255, 255, 10)) and self.nextClickTime < CurTime()) then
if self.terminalPanel then
self.terminalPanel:CreateOption(string.utf8upper("market"))
end
self.nextClickTime = CurTime() + 1.5
end
draw.SimpleText("KOSZYK", "ButtonLabel", 470, 280, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if (imgui.xButton(0, 254, 150, 50, 5, Color(255, 255, 255, 0), Color(255, 255, 255, 255), Color(255, 255, 255, 10)) and self.nextClickTime < CurTime()) then
if self.terminalPanel then
self.terminalPanel:CreateOption(string.utf8upper("cart"))
end
self.nextClickTime = CurTime() + 1.5
end
draw.SimpleText("STATUS", "ButtonLabel", 470, 405, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if (imgui.xButton(0, 378, 150, 50, 5, Color(255, 255, 255, 0), Color(255, 255, 255, 255), Color(255, 255, 255, 10)) and self.nextClickTime < CurTime()) then
if self.terminalPanel then
self.terminalPanel:CreateOption(string.utf8upper("status"))
end
self.nextClickTime = CurTime() + 1.5
end
draw.SimpleText("CYKL", "ButtonLabel", 470, 530, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if (imgui.xButton(0, 503, 150, 50, 5, Color(255, 255, 255, 0), Color(255, 255, 255, 255), Color(255, 255, 255, 10)) and self.nextClickTime < CurTime()) then
if self.terminalPanel then
self.terminalPanel:CreateOption(string.utf8upper("shift"))
end
self.nextClickTime = CurTime() + 1.5
end
--[[draw.SimpleText("CALL-IN", "ButtonLabel", 470, 653, Color(0, 0, 0, 225), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
if (imgui.xButton(0, 628, 150, 50, 5, Color(255, 255, 255, 0), Color(255, 255, 255, 255), Color(255, 255, 255, 10)) and self.nextClickTime < CurTime()) then
self.nextClickTime = CurTime() + 1.5
end--]]
imgui.End3D2D()
end
end

View File

@@ -0,0 +1,263 @@
--[[
| 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")
ENT.localizedCIDTransform = {
vec = Vector(4.281931, -13.669882, 44.2),
ang = Angle(31, -178.43, 180)
}
ENT.localizedCWUCardTransform = {
vec = Vector(11.407880, -13.500206, 33.918171),
ang = Angle(-0.828, 0.935, 0.204)
}
function ENT:CreateUserTimer()
timer.Create("ixCWUTerminal" .. self:GetCreationID(), 5, 0, function()
if !IsValid(self) then return end
local user = self:GetUsedBy()
if user == self then
if self:GetNetVar("broadcasting", false) then
self:ToggleBroadcast()
end
return timer.Remove("ixCWUTerminal" .. self:GetCreationID())
end
if (!IsValid(user) or !user:IsPlayer() or user:EyePos():DistToSqr(self:GetPos()) > 62500 or user:IsAFK()) then
if self:GetNetVar("broadcasting", false) then
self:ToggleBroadcast()
end
if (IsValid(user)) then
if user:GetNetVar("broadcastAuth", false) then
user:SetNetVar("broadcastAuth", nil)
end
end
self:SetUsedBy(self)
net.Start("ix.terminal.turnOff")
net.WriteEntity(self)
net.Broadcast()
timer.Remove("ixCWUTerminal" .. self:GetCreationID())
end
end)
end
function ENT:ToggleBroadcast()
local user = self:GetUsedBy()
local broadcast = !self:GetNetVar("broadcasting", false)
self:SetNetVar("broadcasting", broadcast)
net.Start("ix.terminal.CWUWorkshiftSound")
net.Broadcast()
self.nextBroadcast = CurTime() + 5
if user and user:IsPlayer() then
ix.chat.Send(user, "event", broadcast and "The city's speakers come to life with the signature announcement sound." or "The city's speakers turn off after playing the final distinct announcement sound.", false, nil)
end
end
function ENT:Initialize()
self:SetModel("models/willardnetworks/gearsofindustry/wn_machinery_04.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetCID(-1)
self:SetCWUCard(-1)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
function ENT:SendCharGenData(id)
-- insert gendata later
local genData
local isCCA = false
if ix.char.loaded[id] then
genData = ix.char.loaded[id]:GetGenericdata()
isCCA = ix.char.loaded[id]:GetFaction() == FACTION_ADMIN
self:ConfirmCID(genData, isCCA)
else
local charQuery = mysql:Select("ix_characters")
charQuery:Where("id", tostring(charID))
charQuery:Callback(function(cResult)
if (!istable(cResult) or #cResult == 0) then
return
end
isCCA = ix.faction.GetIndex(cResult[1].faction) == FACTION_ADMIN
local query = mysql:Select("ix_characters_data")
query:Where("key", "genericdata")
query:Where("id", tostring(charID))
query:Select("data")
query:Callback(function(result)
if (!istable(result) or #result == 0) then
return
end
genData = util.JSONToTable(result[1]["data"])
self:ConfirmCID(genData, isCCA)
end)
query:Execute()
end)
charQuery:Execute()
end
end
function ENT:ConfirmCID(genData, isCCA)
self.curGenData = genData
self.curGenData.isCCA = isCCA
local client = self:GetUsedBy()
if client and client:IsPlayer() then
net.Start("ix.terminal.SendCIDInfo")
net.WriteString(util.TableToJSON(genData))
net.WriteEntity(self)
net.Send(client)
end
end
function ENT:IsFullyAuthed()
if (self:HasCID()) then
if self.curGenData and self.curGenData.combine or self.curGenData and self.curGenData.isCCA then
return true
end
end
if (!self:HasCWUCard() or !self:HasCID()) then
return false
end
if ix.item.instances[self:GetCWUCard()]:GetData("cardID") != self:GetCID() then
return false
end
return true
end
function ENT:HasCID()
return self:GetCID() != -1
end
function ENT:OnCIDInsert()
local cid
local client = self:GetUsedBy()
if self:HasCWUCard() then
if !self:IsFullyAuthed() then
ix.combineNotify:AddImportantNotification("WRN:// Unauthorized access to CWU terminal", nil, "unknown", self:GetPos())
if (client and client:IsPlayer()) then
net.Start("ix.terminal.AuthError")
net.WriteEntity(self)
net.Send(client)
end
return
else
cid = ix.item.instances[self:GetCID()]
self:SendCharGenData(cid:GetData("owner"))
end
else
cid = ix.item.instances[self:GetCID()]
self:SendCharGenData(cid:GetData("owner"))
end
end
function ENT:OnCIDDetach()
self.curGenData = nil
local client = self:GetUsedBy()
if (client and client:IsPlayer()) then
net.Start("ix.terminal.SendCIDRemoved")
net.WriteEntity(self)
net.Send(client)
end
end
function ENT:HasCWUCard()
return self:GetCWUCard() != -1
end
function ENT:OnCWUCardInsert()
local client = self:GetUsedBy()
if self:HasCID() then
if !self:IsFullyAuthed() then
ix.combineNotify:AddImportantNotification("WRN:// Unauthorized access to CWU terminal", nil, "unknown", self:GetPos())
if (client and client:IsPlayer()) then
net.Start("ix.terminal.AuthError")
net.WriteEntity(self)
net.Send(client)
end
return
else
if (client and client:IsPlayer()) then
net.Start("ix.terminal.CWUCardInserted")
net.WriteEntity(self)
net.Send(client)
end
end
else
if (client and client:IsPlayer()) then
net.Start("ix.terminal.CWUCardInserted")
net.WriteEntity(self)
net.Send(client)
end
end
end
function ENT:OnCWUCardDetach()
local client = self:GetUsedBy()
if (client and client:IsPlayer()) then
net.Start("ix.terminal.CWUCardRemoved")
net.WriteEntity(self)
net.Send(client)
end
end
function ENT:StartTouch(entity)
if (entity:GetClass() != "ix_item" or entity.attached) then return end
if (entity:GetItemID() != "id_card" and entity:GetItemID() != "cwu_card") then return end
if (self.attachedCID and self.attachedCID != NULL and self.attachedCWUCard and self.attachedCWUCard != NULL) then return end
local physObj = entity:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
if entity:GetItemID() == "id_card" then
self:CIDInsert(entity)
elseif entity:GetItemID() == "cwu_card" then
self:CWUInsert(entity)
end
self:EmitSound("physics/metal/weapon_impact_soft" .. math.random(1, 3) .. ".wav")
end
function ENT:OnRemove()
timer.Remove("ixCWUTerminal" .. self:GetCreationID())
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/
--]]
ENT.Type = "anim"
ENT.PrintName = "CWU Terminal"
ENT.Category = "HL2 RP"
ENT.Spawnable = true
ENT.AdminOnly = true
ENT.PhysgunDisable = true
ENT.PhysgunAllowAdmin = true
function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "UsedBy")
self:NetworkVar("Int", 1, "CID")
self:NetworkVar("Int", 2, "CWUCard")
end
function ENT:CIDInsert(entity)
entity:SetPos(self:LocalToWorld(self.localizedCIDTransform.vec))
entity:SetAngles(self:LocalToWorldAngles(self.localizedCIDTransform.ang))
entity:SetParent(self)
self.attachedCID = entity
entity.attached = self
self:SetCID(entity.ixItemID)
self:OnCIDInsert()
end
function ENT:CWUInsert(entity)
entity:SetPos(self:LocalToWorld(self.localizedCWUCardTransform.vec))
entity:SetAngles(self:LocalToWorldAngles(self.localizedCWUCardTransform.ang))
entity:SetParent(self)
self.attachedCWUCard = entity
entity.attached = self
self:SetCWUCard(entity.ixItemID)
self:OnCWUCardInsert()
end

View File

@@ -0,0 +1,99 @@
--[[
| 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.RenderGroup = RENDERGROUP_TRANSLUCENT
ENT.nextClickTime = 0
function ENT:TurnOn()
net.Start("ix.terminal.turnOn")
net.WriteEntity(self)
net.SendToServer()
end
function ENT:TurnOff()
net.Start("ix.terminal.turnOff")
net.WriteEntity(self)
net.SendToServer()
end
function ENT:CreateStartScreen(client, data)
local encoderMenu = ix.factoryPanels:CreatePanel("ixDataEncoder", self)
encoderMenu:SetUsedBy(client)
encoderMenu:SetDisc(data[1] or false)
self:EmitSound("buttons/button1.wav")
end
function ENT:PurgeScreenPanels(muteSound)
ix.factoryPanels:PurgeEntityPanels(self)
if (!muteSound) then
self:EmitSound("buttons/button5.wav")
end
end
function ENT:OnRemove()
self:PurgeScreenPanels(true)
self:StopSound("wn_goi/terminal_turnon.mp3")
end
ENT.vguiLocalizedTransform = {
vec = Vector(6, -8.9, 65.710434),
ang = Angle(0, 90, 90),
res = 0.01
}
function ENT:DrawTranslucent()
self:DrawModel()
vgui.Start3D2D( self:LocalToWorld(self.vguiLocalizedTransform.vec), self:LocalToWorldAngles(self.vguiLocalizedTransform.ang), self.vguiLocalizedTransform.res )
if self.terminalPanel then
self.terminalPanel:Paint3D2D()
end
vgui.End3D2D()
if (imgui.Entity3D2D(self, Vector(5.502635, -6.055101, 55.513432), Angle(90, 0, 0), 0.01)) then
if (imgui.xButton(-75, -150, 100, 300, 5, Color(255, 44, 44, 0), Color(255, 44, 44, 75), Color(255, 44, 44, 10))) then
if (!self.terminalPanel and self.nextClickTime < CurTime()) then
self:TurnOn()
self.nextClickTime = CurTime() + 1.5
elseif (self.terminalPanel and self.nextClickTime < CurTime()) then
self:TurnOff()
self.nextClickTime = CurTime() + 1.5
end
end
imgui.End3D2D()
end
if (!self:GetNetVar("scanning") or !IsEntity(self:GetNetVar("scanning")) or !IsValid(self:GetNetVar("scanning"))) then return end
local topPos = self:LocalToWorld(Vector(0.139367, -0.340202, 47.403870))
if (!LocalPlayer():IsLineOfSightClear(topPos)) then return end
local trace = {}
trace.mask = CONTENTS_SOLID + CONTENTS_MOVEABLE + CONTENTS_OPAQUE + CONTENTS_DEBRIS + CONTENTS_HITBOX + CONTENTS_MONSTER
trace.start = LocalPlayer():EyePos()
trace.endpos = topPos
trace.filter = {LocalPlayer()}
trace = util.TraceLine(trace)
if (trace.Fraction < 0.75) then return end
local right = self:GetRight() * math.sin(CurTime()) * 2
for i = 1, 4 do
render.DrawLine(self:LocalToWorld(self.linePoses[i]), self:GetNetVar("scanning"):LocalToWorld(self:GetNetVar("scanning"):OBBCenter()) + right * (i / 2), Color(255, math.random(50, 255), 0, math.random(100)))
end
end

View File

@@ -0,0 +1,238 @@
--[[
| 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")
ENT.scanBox = {
mins = Vector(-8.344721, -7.158762, 39.878693),
maxs = Vector(2.849499, 6.975823, 49.807785)
}
ENT.nextScan = 0
ENT.batteryChargeReq = 1
function ENT:CreateUserTimer()
timer.Create("ixDiscScanner" .. self:GetCreationID(), 5, 0, function()
if !IsValid(self) then return end
local user = self:GetUsedBy()
if user == self then return timer.Remove("ixDiscScanner" .. self:GetCreationID()) end
if (!IsValid(user) or !user:IsPlayer() or user:EyePos():DistToSqr(self:GetPos()) > 62500 or user:IsAFK()) then
self:SetUsedBy(self)
net.Start("ix.terminal.turnOff")
net.WriteEntity(self)
net.Broadcast()
timer.Remove("ixDiscScanner" .. self:GetCreationID())
end
end)
end
function ENT:OnRemove()
timer.Remove("ixDiscScanner" .. self:GetCreationID())
end
function ENT:HasBattery()
return IsValid(self.attachedBattery)
end
function ENT:BatteryHasCharge(charge)
return self.attachedBattery:GetData("charge", 0) >= charge
end
function ENT:TakeBatteryCharge(charge)
ix.item.instances[self.attachedBattery.ixItemID]:SetData("charge", self.attachedBattery:GetData("charge") - charge)
end
function ENT:Initialize()
self:SetModel("models/willardnetworks/gearsofindustry/wn_machinery_02.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetTrigger(true)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
function ENT:SearchForItem()
local mins = self:LocalToWorld(self.scanBox.mins)
local maxs = self:LocalToWorld(self.scanBox.maxs)
for _, item in pairs(ents.FindInBox(mins, maxs)) do
if item:GetClass() != "ix_item" then continue end
return item
end
end
function ENT:Scan(client)
if self.bScanning then return end
local item = self:SearchForItem()
if item then
if !ix.fabrication:GetTech(item:GetItemID()) and !ix.fabrication:GetAdvancedTech(item:GetItemID()) then
return "This item cannot be encoded into data disc."
end
if self.attachedDisc:GetData("item", "") != "" then
return "This disc already have data on it."
end
if !self:HasBattery() then return "Data-disc encoder requires combine battery in order to function!" end
if !self:BatteryHasCharge(self.batteryChargeReq) then return "Battery don't have enough charge." end
self:TakeBatteryCharge(self.batteryChargeReq)
item:GetPhysicsObject():EnableMotion(false)
local ef = EffectData()
ef:SetEntity(item)
ef:SetScale(self.scanTimer)
util.Effect("scanGlow", ef)
self:SetNetVar("scanning", item)
self.bScanning = true
if client and client:IsPlayer() then
net.Start("ix.terminal.Scan")
net.WriteEntity(self)
net.Send(client)
end
item.inUse = true
self.attachedDisc.inUse = true
self:EmitSound("wn_goi/disc_encode_start.wav", 55, 100, 1, nil, 0, 11)
timer.Simple(SoundDuration("wn_goi/disc_encode_start.wav"), function()
self:EmitSound("wn_goi/disc_encode_loop.wav", 55, 100, 1, nil, 0, 11)
end)
timer.Simple(self.scanTimer, function()
if (item and IsValid(item)) then
item.inUse = nil
item:GetPhysicsObject():EnableMotion(true)
end
if (self.attachedDisc and IsValid(self.attachedDisc)) then
self.attachedDisc.inUse = nil
end
if !IsValid(self) or !IsValid(item) or !IsValid(self.attachedDisc) then
if IsValid(self) then
self:StopSound("wn_goi/disc_encode_loop.wav")
end
return "Error!"
end
self.bScanning = false
self:SetNetVar("scanning", nil)
self:StopSound("wn_goi/disc_encode_loop.wav")
self:EmitSound("wn_goi/disc_encode_stop.wav", 55, 100, 1, nil, 0, 11)
ix.item.instances[self.attachedDisc.ixItemID]:SetData("item", item:GetItemID())
self:SetDiscItemID(self.attachedDisc:GetData("item", ""))
ef = EffectData()
ef:SetOrigin(self:LocalToWorld(Vector(4.453487, 0.434061, 39.031250)))
util.Effect("scanVaporize", ef)
item:Remove()
self:EmitSound("ambience/3d-sounds/steam/steam07.wav")
if client and client:IsPlayer() then
net.Start("ix.terminal.DiscAttach")
net.WriteEntity(self)
net.WriteString(self:GetDiscItemID() or "")
net.Send(client)
end
end)
else
return "There's no items in terminal depot."
end
end
function ENT:SetDiscItemID(itemID)
self.dItemID = itemID
end
function ENT:GetDiscItemID()
return self.dItemID or ""
end
function ENT:OnDiscAttach(disc)
self:SetDiscItemID(disc:GetData("item", ""))
self:SetNetVar("attachedDisc", disc)
local client = self:GetUsedBy()
if client and client:IsPlayer() then
net.Start("ix.terminal.DiscAttach")
net.WriteEntity(self)
net.WriteString(self:GetDiscItemID() or "")
net.Send(client)
end
end
function ENT:OnDiscDetach(disc)
self:SetDiscItemID(nil)
self:SetNetVar("attachedDisc", nil)
local client = self:GetUsedBy()
if client and client:IsPlayer() then
net.Start("ix.terminal.DiscDetach")
net.WriteEntity(self)
net.Send(client)
end
end
function ENT:StartTouch(entity)
if (entity:GetClass() != "ix_item" or entity.attached) then return end
local attachmentPos = self:GetPos()
local attachmentAngle = self:GetAngles()
if (entity:GetItemID() == "combinebattery") then
if (self.attachedBattery and self.attachedBattery != NULL) then return end
attachmentPos = self:LocalToWorld(Vector(-3.006432, -14.451619, 10.576401))
attachmentAngle = self:LocalToWorldAngles(Angle(-0.281, -89.269, 89.798))
self.attachedBattery = entity
elseif (entity:GetItemID() == "datadisc") then
if (self.attachedDisc and self.attachedDisc != NULL) then return end
attachmentPos = self:GetPos() + self:GetUp() * 55.4 + self:GetRight() * -4.5 + self:GetForward() * 5
self.attachedDisc = entity
self:OnDiscAttach(entity)
else return end
local physObj = entity:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
entity:SetPos(attachmentPos)
entity:SetAngles(attachmentAngle)
entity:SetParent(self)
entity.attached = self
self:EmitSound("physics/metal/weapon_impact_soft" .. math.random(1, 3) .. ".wav")
end

View File

@@ -0,0 +1,29 @@
--[[
| 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.PrintName = "Data-Disc Scanner"
ENT.Category = "HL2 RP"
ENT.Spawnable = true
ENT.AdminOnly = true
ENT.PhysgunDisable = true
ENT.PhysgunAllowAdmin = true
ENT.scanTimer = 5
ENT.linePoses = {
Vector(-0.591944, 2.154315, 50),
Vector(0.672625, -0.008970, 50),
Vector(-0.630802, -2.203331, 50),
Vector(-1.493779, -0.068308, 50)
}
function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "UsedBy")
end

View File

@@ -0,0 +1,75 @@
--[[
| 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.RenderGroup = RENDERGROUP_TRANSLUCENT
ENT.nextClickTime = 0
function ENT:TurnOn()
net.Start("ix.terminal.turnOn")
net.WriteEntity(self)
net.SendToServer()
end
function ENT:TurnOff()
net.Start("ix.terminal.turnOff")
net.WriteEntity(self)
net.SendToServer()
end
function ENT:CreateStartScreen(client, data)
local fabricatorMenu = ix.factoryPanels:CreatePanel("ixFabricator", self)
fabricatorMenu:SetUsedBy(client)
fabricatorMenu:SetDisc(data[1] or "")
self:EmitSound("buttons/button1.wav")
end
function ENT:PurgeScreenPanels(muteSound)
ix.factoryPanels:PurgeEntityPanels(self)
if (!muteSound) then
self:EmitSound("buttons/button5.wav")
end
end
function ENT:OnRemove()
self:PurgeScreenPanels(true)
self:StopSound("wn_goi/terminal_turnon.mp3")
end
ENT.vguiLocalizedTransform = {
vec = Vector(16, -40.15, 43.25),
ang = Angle(0, 65, 55),
res = 0.01
}
function ENT:DrawTranslucent()
self:DrawModel()
vgui.Start3D2D( self:LocalToWorld(self.vguiLocalizedTransform.vec), self:LocalToWorldAngles(self.vguiLocalizedTransform.ang), self.vguiLocalizedTransform.res )
if self.terminalPanel then
self.terminalPanel:Paint3D2D()
end
vgui.End3D2D()
if (imgui.Entity3D2D(self, Vector(17.592129, -44.555752, 40.282715), Angle(0, 65, 55), 0.01)) then
if (imgui.xButton(-165, 10, 285, 135, 5, Color(255, 44, 44, 0), Color(255, 44, 44, 255), Color(255, 44, 44, 10))) then
if (!self.terminalPanel and self.nextClickTime < CurTime()) then
self:TurnOn()
self.nextClickTime = CurTime() + 1.5
elseif (self.terminalPanel and self.nextClickTime < CurTime()) then
self:TurnOff()
self.nextClickTime = CurTime() + 1.5
end
end
imgui.End3D2D()
end
end

View File

@@ -0,0 +1,429 @@
--[[
| 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")
ENT.nextInteraction = 0
ENT.interactionCooldown = 0.25
ENT.batteryChargeReq = 1
function ENT:CreateUserTimer()
timer.Create("ixFabricator" .. self:GetCreationID(), 5, 0, function()
if !IsValid(self) then return end
local user = self:GetUsedBy()
if user == self then return timer.Remove("ixFabricator" .. self:GetCreationID()) end
if (!IsValid(user) or !user:IsPlayer() or user:EyePos():DistToSqr(self:GetPos()) > 62500 or user:IsAFK()) then
self:SetUsedBy(self)
net.Start("ix.terminal.turnOff")
net.WriteEntity(self)
net.Broadcast()
timer.Remove("ixFabricator" .. self:GetCreationID())
end
end)
end
function ENT:OnRemove()
timer.Remove("ixFabricator" .. self:GetCreationID())
end
function ENT:Initialize()
self:SetModel("models/willardnetworks/gearsofindustry/wn_machinery_03.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetTrigger(true)
local physObj = self:GetPhysicsObject()
self.opened = false
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
function ENT:HasBattery()
return IsValid(self.attachedBattery)
end
function ENT:BatteryHasCharge(charge)
return self.attachedBattery:GetData("charge", 0) >= charge
end
function ENT:TakeBatteryCharge(charge)
ix.item.instances[self.attachedBattery.ixItemID]:SetData("charge", self.attachedBattery:GetData("charge") - charge)
end
function ENT:SetDiscItemID(itemID)
self.dItemID = itemID
end
function ENT:GetDiscItemID()
return self.dItemID or ""
end
function ENT:OnDiscAttach(disc)
local client = self:GetUsedBy()
if !ix.fabrication:Get(disc:GetData("item", "")) then
if client and client:IsPlayer() then
client:NotifyLocalized("Data disc is corrupted.")
end
return
end
self:SetDiscItemID(disc:GetData("item", ""))
self:SetNetVar("attachedDisc", disc)
if client and client:IsPlayer() then
net.Start("ix.terminal.DiscAttach")
net.WriteEntity(self)
net.WriteString(self:GetDiscItemID() or "")
net.Send(client)
end
end
function ENT:OnDiscDetach(disc)
self:SetDiscItemID("")
self:SetNetVar("attachedDisc", nil)
local client = self:GetUsedBy()
if client and client:IsPlayer() then
net.Start("ix.terminal.DiscDetach")
net.WriteEntity(self)
net.Send(client)
end
end
ENT.dispenseBox = {
mins = Vector(5.035011, 4.218863, 45.633255),
maxs = Vector(17.356579, -23.244238, 33.593277)
}
function ENT:SearchForItem()
local mins = self:LocalToWorld(self.dispenseBox.mins)
local maxs = self:LocalToWorld(self.dispenseBox.maxs)
for _, item in pairs(ents.FindInBox(mins, maxs)) do
if item:GetClass() != "ix_item" then continue end
if self.attachedDisc and item == self.attachedDisc then continue end
return item
end
end
ENT.nextDepotToggle = 0
function ENT:OpenDepot()
self:ResetSequence("Open")
self.opened = true
end
function ENT:CloseDepot()
self:ResetSequence("Close")
self.opened = false
end
function ENT:ToggleDepot()
if self.bSynthesizing then return "Fabricator is active: you can't do anything else with it yet." end
if self.nextDepotToggle > CurTime() then return "You have to wait a bit before using this again." end
if self.opened then self:CloseDepot() else self:OpenDepot() end
self.nextDepotToggle = CurTime() + 2.5
end
function ENT:Recycle(client)
if self.bSynthesizing then return "Fabricator is active: you can't do anything else with it yet." end
if self.nextInteraction > CurTime() then return "You have to wait a bit until next interaction." end
self.nextInteraction = CurTime() + self.interactionCooldown
if !IsValid(client) or !client:IsPlayer() then return "Invalid client." end
if !self:HasBattery() then return "Fabricator requires combine battery in order to function!" end
if !self:BatteryHasCharge(self.batteryChargeReq) then return "Battery don't have enough charge." end
self:TakeBatteryCharge(self.batteryChargeReq)
local recycledItem
local item = self:SearchForItem()
if !item then
return "There's no item in fabricator depot."
end
local itemID = item:GetItemID()
for _, material in pairs(ix.fabrication.MAIN_MATS) do
if material == itemID then
return "You can't recycle this!"
end
end
local bClosedDepot = true
if self.opened then
self:CloseDepot()
bClosedDepot = false
end
self.bSynthesizing = true
timer.Simple(bClosedDepot and 0.1 or 2.5, function()
if (!IsValid(self)) then return end
if (!IsValid(item)) then
self.bSynthesizing = false
return self:OpenDepot()
end
self:EmitSound("ambience/3d-sounds/electronics/hipowerup_01.wav")
recycledItem = item.ixItemID
item:Remove()
timer.Simple(6.6, function()
if (!IsValid(self)) then return end
for _, pipe in pairs(self.smallSteamPipes) do
ParticleEffect("steamjet", self:LocalToWorld(pipe.vec), self:LocalToWorldAngles(pipe.ang), self)
end
self:EmitSound("ambience/3d-sounds/electronics/openingpowerup_13.wav")
self:DispenseRecycledMaterials(recycledItem)
end)
end)
end
function ENT:DispenseRecycledMaterials(item)
item = ix.item.instances[item]
if !item then
self.bSynthesizing = false
return self:OpenDepot()
end
local itemToDispense
local matAmount = item.category != "Ammunition" and item:GetData("stack", 1) or 1
if item.category == "Food" or item.category == "Ingredient" then
itemToDispense = ix.fabrication.MAIN_MATS["bio"]
else
itemToDispense = ix.fabrication.MAIN_MATS["tech"]
end
local fabrication = ix.fabrication:Get(item.uniqueID)
if fabrication then
itemToDispense = ix.fabrication.MAIN_MATS[fabrication:GetCategory()]
if item.category == "Ammunition" then
matAmount = fabrication:GetMainMaterialCost()
else
matAmount = fabrication:GetMainMaterialCost() * item:GetData("stack", 1)
end
end
if matAmount > 1 then
self:MultipleDispense(itemToDispense, matAmount)
else
self:Dispense(itemToDispense)
end
end
function ENT:MultipleDispense(item, amount)
self.mDispensing = {item = item, amount = amount}
self:Dispense(item)
end
function ENT:Dispense(item)
ix.item.Spawn(item, self:GetPos(), function(_, ent)
ent:SetPos(self:GetAttachment(1).Pos)
self.dispensedObject = ent
ent.dispenser = self
ent:GetPhysicsObject():EnableMotion(false)
end, self:GetAngles())
self:OpenDepot()
end
function ENT:OnDispensedItemTaken()
if self.mDispensing then
if self.mDispensing.amount > 1 then
self:CloseDepot()
end
self.mDispensing.amount = self.mDispensing.amount - 1
timer.Simple(2, function()
if (!IsValid(self)) then return end
if (!self.mDispensing) then return end
self:Dispense(self.mDispensing.item)
end)
if self.mDispensing.amount > 0 then
return
else
self.mDispensing = nil
end
end
self.bSynthesizing = false
if self.opened and self.mDispensing and self.mDispensing.amount > 0 then
self:CloseDepot()
end
end
function ENT:SynthesizeFabrication(client, fabrication, isBulk, amount)
if self.bSynthesizing then return "Fabricator is active: you can't do anything else with it yet." end
if self.nextInteraction > CurTime() then return "You have to wait a bit until next interaction." end
self.nextInteraction = CurTime() + self.interactionCooldown
if !IsValid(client) or !client:IsPlayer() then return "Invalid client." end
fabrication = ix.fabrication:Get(fabrication)
if !fabrication then return "Selected fabrication is invalid." end
if !self:HasBattery() then return "Fabricator requires combine battery in order to function!" end
if !self:BatteryHasCharge(self.batteryChargeReq) then return "Battery don't have enough charge." end
local character = client:GetCharacter()
local inventory = character:GetInventory()
local resourceItemID = ix.fabrication.MAIN_MATS[fabrication:GetCategory()]
local resourceItem = ix.item.list[resourceItemID]
local hasItem = inventory:GetItemsByUniqueID(resourceItemID)
local isStackable = resourceItem.maxStackSize != nil
local resourcesToTake = fabrication:GetMainMaterialCost()
if (isBulk) then
resourcesToTake = resourcesToTake * amount
end
if !hasItem or !istable(hasItem) or table.IsEmpty(hasItem) then
return "Unable to find required materials in your inventory."
end
local totalItemCount = 0
if isStackable then
for _, rItem in pairs(hasItem) do
totalItemCount = totalItemCount + rItem:GetStackSize()
end
if totalItemCount >= resourcesToTake then
for _, rItem in pairs(hasItem) do
if resourcesToTake <= 0 then
break
end
local actualStackSize = rItem:GetStackSize()
rItem:RemoveStack(resourcesToTake)
resourcesToTake = resourcesToTake - actualStackSize
end
else
return "You don't have enough resources for this fabrication."
end
else
totalItemCount = totalItemCount + #hasItem
if totalItemCount >= resourcesToTake then
for _, rItem in pairs(hasItem) do
if resourcesToTake <= 0 then break end
rItem:Remove()
resourcesToTake = resourcesToTake - 1
end
else
return "You don't have enough resources for this fabrication."
end
end
if self.opened then
self:CloseDepot()
end
self.bSynthesizing = true
self:TakeBatteryCharge(self.batteryChargeReq)
self:EmitSound("ambience/3d-sounds/electronics/hipowerup_01.wav")
-- i frickin' love timer simple pyramids
timer.Simple(6.6, function()
if (!IsValid(self)) then return end
self:EmitSound("ambience/3d-sounds/steam/steam2.wav")
ParticleEffect("steam_jet_50", self:LocalToWorld(self.bigSteamJet.vec), self:LocalToWorldAngles(self.bigSteamJet.ang), self)
timer.Simple(2.9, function()
if (!IsValid(self)) then return end
self:StopParticles()
self:EmitSound("ambience/3d-sounds/nexus/printer_verb.ogg")
timer.Simple(11.2, function()
if (!IsValid(self)) then return end
self:EmitSound("ambience/3d-sounds/steam/steam01.wav")
for _, pipe in pairs(self.smallSteamPipes) do
ParticleEffect("steamjet", self:LocalToWorld(pipe.vec), self:LocalToWorldAngles(pipe.ang), self)
end
timer.Simple(1.8, function()
if (!IsValid(self)) then return end
if (isBulk) then
self:MultipleDispense(fabrication:GetID(), amount)
else
self:Dispense(fabrication:GetID())
end
end)
end)
end)
end)
end
function ENT:Think()
self:NextThink( CurTime() )
return true
end
function ENT:StartTouch(entity)
if (entity:GetClass() != "ix_item" or entity.attached) then return end
local attachmentPos = self:GetPos()
local attachmentAngle = self:GetAngles()
if (entity:GetItemID() == "combinebattery") then
if (self.attachedBattery and self.attachedBattery != NULL) then return end
attachmentPos = self:LocalToWorld(Vector(17.081011, -3.726678, 25.982630))
attachmentAngle = self:LocalToWorldAngles(Angle(8.451, 7.097, 98.399))
self.attachedBattery = entity
elseif (entity:GetItemID() == "datadisc") then
if (self.attachedDisc and self.attachedDisc != NULL) then return end
attachmentPos = self:LocalToWorld(Vector(21.495632, -24.401604, 37.726032))
attachmentAngle = self:LocalToWorldAngles(Angle(0.693, 2.259, 88.879))
self.attachedDisc = entity
self:OnDiscAttach(entity)
else return end
local physObj = entity:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
entity:SetPos(attachmentPos)
entity:SetAngles(attachmentAngle)
entity:SetParent(self)
entity.attached = self
self:EmitSound("physics/metal/weapon_impact_soft" .. math.random(1, 3) .. ".wav")
end

View File

@@ -0,0 +1,34 @@
--[[
| 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.PrintName = "Fabricator"
ENT.Category = "HL2 RP"
ENT.Spawnable = true
ENT.AdminOnly = true
ENT.PhysgunDisable = true
ENT.PhysgunAllowAdmin = true
ENT.AutomaticFrameAdvance = true
ENT.bigSteamJet = {
vec = Vector(1.659318, 56.163685, 33.053894),
ang = Angle(0, 90, 0)
}
ENT.smallSteamPipes = {
{vec = Vector(20.475733, 34.197407, 12.701706), ang = Angle(-60, -75, 0)},
{vec = Vector(20.420990, 28.903364, 12.851990), ang = Angle(-60, -75, 0)},
{vec = Vector(20.008125, -16.373440, 23.055595), ang = Angle(-90, -90, 0)}
}
ENT.dispensePos = Vector(12.057754, -13.228306, 39.473038)
function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "UsedBy")
end

View File

@@ -0,0 +1,53 @@
--[[
| 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.RenderGroup = RENDERGROUP_TRANSLUCENT
function ENT:CreateStartScreen()
local shopMenu = ix.factoryPanels:CreatePanel("ixShopTerminal", self)
shopMenu:BuildShopPanel({
shopName = self:GetShop(),
cost = self:GetShopCost(),
scReq = self:GetShopSocialCreditReq(),
rent = self:GetNetVar("Rent", 0)
})
end
function ENT:PurgeScreenPanels(muteSound)
ix.factoryPanels:PurgeEntityPanels(self)
end
function ENT:OnRemove()
self:PurgeScreenPanels(true)
end
ENT.vguiLocalizedTransform = {
vec = Vector(13, -6.7, 20),
ang = Angle(0, 90, 90),
res = 0.01
}
function ENT:DrawTranslucent()
self:DrawModel()
vgui.Start3D2D( self:LocalToWorld(self.vguiLocalizedTransform.vec), self:LocalToWorldAngles(self.vguiLocalizedTransform.ang), self.vguiLocalizedTransform.res )
if self.terminalPanel then
self.terminalPanel:Paint3D2D()
end
vgui.End3D2D()
end
function ENT:Initialize()
self:CreateStartScreen()
end

View File

@@ -0,0 +1,110 @@
--[[
| 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_combine/combine_smallmonitor001.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetTrigger(true)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
self:SetNetVar("isPurchasable", self:IsPurchasable())
end
function ENT:SetShop(shop)
local housing = ix.plugin.Get("housing")
local foundShop = false
for k, apartment in pairs(housing.apartments) do
if apartment.name == shop and apartment.type == "shop" then
self:SetNetVar("shop", shop)
self:SetNetVar("shopID", i)
foundShop = true
end
end
if !foundShop then
return "No shops found"
end
self:UpdateScreen()
end
function ENT:GetShopID()
local shop = self:GetShop()
local housing = ix.plugin.Get("housing")
for k, fShop in pairs(housing.apartments) do
if fShop.name == shop and fShop.type == "shop" then
return k
end
end
return false
end
function ENT:SetShopCost(cost)
if !self:GetShop() then return "You must link this terminal with shop first!" end
self:SetNetVar("cost", cost)
self:UpdateScreen()
end
function ENT:SetShopSocialCreditReq(sc)
if !self:GetShop() then return "You must link this terminal with shop first!" end
self:SetNetVar("sc", sc)
self:UpdateScreen()
end
function ENT:UpdateRent()
local shop = self:GetShop()
if !shop then return false end
local housing = ix.plugin.Get("housing")
local foundShop = false
for k, fShop in pairs(housing.apartments) do
if fShop.name == shop and fShop.type == "shop" then
foundShop = fShop
end
end
if !foundShop then
return false
end
self:SetNetVar("Rent", foundShop.rent)
end
function ENT:UpdateScreen()
self:SetNetVar("isPurchasable", self:IsPurchasable())
self:UpdateRent()
for _, client in ipairs(player.GetAll()) do
netstream.Start(client, "UpdateShopScreen")
end
end
function ENT:StartTouch(entity)
end

View File

@@ -0,0 +1,53 @@
--[[
| 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.PrintName = "Shop Terminal"
ENT.Category = "HL2 RP"
ENT.Spawnable = true
ENT.AdminOnly = true
ENT.PhysgunDisable = true
ENT.PhysgunAllowAdmin = true
function ENT:GetShop()
return self:GetNetVar("shop", false)
end
function ENT:GetShopCost()
return self:GetNetVar("cost", false)
end
function ENT:GetShopSocialCreditReq()
return self:GetNetVar("sc", false)
end
function ENT:IsPurchasable()
local shop = self:GetShop()
if !shop then return false end
local housing = ix.plugin.Get("housing")
local foundShop = false
for _, fShop in pairs(housing.apartments) do
if fShop.name == shop and fShop.type == "shop" then
foundShop = fShop
end
end
if !foundShop then
return false
end
if foundShop.tenants and table.IsEmpty(foundShop.tenants) then
return true
end
return false
end