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,25 @@
--[[
| 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:InitPostEntity()
for _, entityData in pairs(self.usableEntityLookup) do
if (entityData.class == "ix_clock" and !timer.Exists("ix_clock_ambience")) then
timer.Create("ix_clock_ambience", 1, 0, function()
for _, entity in ipairs(ents.FindByClass("ix_clock")) do
if (entity:GetNetVar("enabled")) then
entity:StopSound("tick.wav")
entity:EmitSound("tick.wav", 60, math.random(95, 105), 1, CHAN_AUTO)
end
end
end)
end
end
end

View File

@@ -0,0 +1,24 @@
--[[
| 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
function ENT:OnPopulateEntityInfo(container)
local time = StormFox2 and ix.date.GetFormatted(StormFox2.Time.TimeToString()) or ix.date.GetFormatted("%H:%M")
local lastTime = self:GetNetVar("lastTime")
local description = container:AddRow("description")
description:SetFont("TitlesFontNoClamp")
description:SetText(self:GetNetVar("enabled") and time or lastTime)
description:SizeToContents()
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")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function ENT:Initialize()
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetNetVar("enabled", true)
self:SetNetVar("lastTime", 0)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
function ENT:Use()
local isEnabled = self:GetNetVar("enabled")
self:EmitSound("buttons/lightswitch2.wav")
if (isEnabled) then
self:SetNetVar("lastTime", StormFox2 and ix.date.GetFormatted(StormFox2.Time.TimeToString()) or ix.date.GetFormatted("%H:%M"))
self:SetNetVar("enabled", false)
else
self:SetNetVar("enabled", true)
self:SetNetVar("lastTime", nil)
end
end

View File

@@ -0,0 +1,15 @@
--[[
| 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 = "Clock"
ENT.Spawnable = false
ENT.bNoPersist = true

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/
--]]
local PLUGIN = PLUGIN
include("shared.lua")
function ENT:Think()
if (self:GetNetVar("enabled")) then
local light = DynamicLight(self:EntIndex())
local data = PLUGIN.usableEntityLookup[string.lower(self:GetModel())] -- I should optimize this...
light.pos = self:GetPos() + (self:GetUp() * (data.upOffset or 1)) + (self:GetForward() * (data.forwardOffset or 1))
light.r = data.color.r
light.g = data.color.g
light.b = data.color.b
light.brightness = 1
light.Decay = 1000
light.Size = data.lightSize
light.DieTime = CurTime() + 1
end
end

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/
--]]
local PLUGIN = PLUGIN
include("shared.lua")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function ENT:Initialize()
self:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetNetVar("enabled", false)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
function ENT:Use()
local data = PLUGIN.usableEntityLookup[string.lower(self:GetModel())]
self:EmitSound(data.sound or "buttons/lightswitch2.wav")
self:SetNetVar("enabled", !self:GetNetVar("enabled"))
if (data.changeSkin) then
self:SetSkin(self:GetNetVar("enabled") and 1 or 0)
end
end

View File

@@ -0,0 +1,15 @@
--[[
| 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 = "Lamp"
ENT.Spawnable = false
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/
--]]
include("shared.lua")
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
function ENT:Initialize()
self:SetModel("models/sleepjie/opensign2.mdl")
self:SetSolid(SOLID_VPHYSICS)
self:PhysicsInit(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
self:SetCollisionGroup(COLLISION_GROUP_NONE)
self:SetSkin(1)
local physObj = self:GetPhysicsObject()
if IsValid(physObj) then
physObj:EnableMotion(false)
physObj:Sleep()
end
end
function ENT:Use()
self:ToggleState()
end
function ENT:ToggleState()
local state = not self.enabled
self.enabled = state
self:SetSkin(state and 0 or 1)
self:EmitSound("buttons/lightswitch2.wav")
end

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/
--]]
ENT.Type = "anim"
ENT.PrintName = "Shop Sign"
ENT.Category = "HL2 RP"
ENT.Spawnable = 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,90 @@
--[[
| 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:PhysicsInit(SOLID_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetUseType(SIMPLE_USE)
local physObj = self:GetPhysicsObject()
if (IsValid(physObj)) then
physObj:EnableMotion(false)
physObj:Sleep()
end
ix.inventory.New(0, "toilet", function(inventory)
if (!IsValid(self)) then return end
if (inventory) then
inventory.vars.isBag = true
self:SetNetVar("ID", inventory:GetID())
end
end)
end
function ENT:OnOptionSelected(client, option, data)
if (option == "Open") then
local inventory = ix.item.inventories[self:GetNetVar("ID")]
if (inventory) then
ix.storage.Open(client, inventory, {
name = "Toilet",
entity = self,
searchTime = 1
})
end
elseif (option == "Flush") then
if (self.nextFlush or 0) < CurTime() then
self.nextFlush = CurTime() + 7
local inventory = ix.item.inventories[self:GetNetVar("ID")]
if (inventory) then
for _, item in pairs(inventory:GetItems()) do
item:Remove()
end
end
self:EmitSound("ambient/machines/usetoilet_flush1.wav", nil, math.random(90, 110))
end
end
end
function ENT:OnRemove()
if (!ix.shuttingDown) then
local index = self:GetNetVar("ID")
if (!self.ixIsSafe and ix.entityDataLoaded and index) then
local inventory = index != 0 and ix.item.inventories[index]
if (inventory) then
ix.item.inventories[index] = nil
local query = mysql:Delete("ix_items")
query:Where("inventory_id", index)
query:Execute()
query = mysql:Delete("ix_inventories")
query:Where("inventory_id", index)
query:Execute()
hook.Run("ContainerRemoved", self, inventory)
end
end
end
end

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/
--]]
ENT.Type = "anim"
ENT.PrintName = "Toilet"
ENT.Spawnable = false
ENT.bNoPersist = true
function ENT:GetEntityMenu(client)
return {["Open"] = true, ["Flush"] = true}
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/
--]]
-- I should probably add this in the storage plugin but meh.
function PLUGIN:CanTransferItem(itemTable, curInv, inventory)
if (inventory and inventory.storageInfo and inventory.storageInfo.entity and inventory.storageInfo.entity:IsValid()) then
local containerInfo = ix.container.stored[inventory.storageInfo.entity:GetModel()]
if (containerInfo and containerInfo.restriction) then
if (!table.HasValue(containerInfo.restriction, itemTable.uniqueID) and !table.HasValue(containerInfo.restriction, itemTable.base)) then
return false
end
end
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/
--]]
local PLUGIN = PLUGIN
PLUGIN.name = "Usable Entities"
PLUGIN.author = "Aspect™"
PLUGIN.description = "Makes certain entities actually usable."
PLUGIN.usableEntityLookup = {
["models/props_c17/clock01.mdl"] = {class = "ix_clock"},
["models/props_combine/breenclock.mdl"] = {class = "ix_clock"},
["models/props_trainstation/clock01.mdl"] = {class = "ix_clock"},
["models/props_trainstation/trainstation_clock001.mdl"] = {class = "ix_clock"},
["models/props_interiors/furniture_lamp01a.mdl"] = {class = "ix_lamp", upOffset = 50, lightSize = 500, color = Color(255, 216, 135)},
["models/props_interiors/furniture_lamp01a_static.mdl"] = {class = "ix_lamp", upOffset = 50, lightSize = 500, color = Color(255, 216, 135)},
["models/props_interiors/lamp_floor.mdl"] = {class = "ix_lamp", upOffset = 60, lightSize = 500, changeSkin = true, color = Color(255, 216, 135)},
["models/props_interiors/lamp_table02.mdl"] = {class = "ix_lamp", upOffset = 30, lightSize = 500, changeSkin = true, color = Color(255, 216, 135)},
["models/props_lab/desklamp01.mdl"] = {class = "ix_lamp", forwardOffset = 10, lightSize = 256, color = Color(255, 216, 135)},
["models/props_combine/combine_light001a.mdl"] = {class = "ix_lamp", forwardOffset = -30, upOffset = 25, lightSize = 500, color = Color(175, 175, 255), sound = "buttons/button1.wav"},
["models/props_combine/combine_light001b.mdl"] = {class = "ix_lamp", forwardOffset = -50, upOffset = 35, lightSize = 1000, color = Color(175, 175, 255), sound = "buttons/button1.wav"},
["models/props_combine/combine_light002a.mdl"] = {class = "ix_lamp", forwardOffset = -30, upOffset = 25, lightSize = 500, color = Color(175, 175, 255), sound = "buttons/button1.wav"},
["models/props_c17/furnituretoilet001a.mdl"] = {class = "ix_toilet"},
["models/props_wasteland/prison_toilet01.mdl"] = {class = "ix_toilet"},
}
ix.container.Register("models/props/cs_havana/bookcase_large.mdl", {
name = "Bookcase",
description = "A large bookcase with five shelves.",
width = 10,
height = 5,
restriction = {"book"}
})
ix.container.Register("models/props/cs_havana/bookcase_small.mdl", {
name = "Bookcase",
description = "A bookcase with five shelves.",
width = 5,
height = 5,
restriction = {"book"}
})
ix.container.Register("models/props_furniture/bookcase_small.mdl", {
name = "Bookcase",
description = "A bookcase with five shelves.",
width = 5,
height = 5,
restriction = {"book"}
})
ix.container.Register("models/props/cs_office/bookshelf1.mdl", {
name = "Bookcase",
description = "A bookcase with five shelves.",
width = 4,
height = 5,
restriction = {"book"}
})
ix.container.Register("models/props/cs_office/bookshelf2.mdl", {
name = "Bookcase",
description = "A bookcase with five shelves.",
width = 4,
height = 5,
restriction = {"book"}
})
ix.container.Register("models/props/cs_office/bookshelf3.mdl", {
name = "Bookcase",
description = "A bookcase with five shelves.",
width = 4,
height = 5,
restriction = {"book"}
})
ix.container.Register("models/props_interiors/desk_executive.mdl", {
name = "Wooden Desk",
description = "A large, wooden desk with four small drawers on each side.",
width = 2,
height = 4
})
ix.container.Register("models/props_combine/breendesk.mdl", {
name = "Wooden Desk",
description = "A large, wooden desk with three small drawers on each side.",
width = 2,
height = 3
})
ix.container.Register("models/props_furniture/desk1.mdl", {
name = "Wooden Desk",
description = "A medium-sized wooden desk with four small drawers and two large ones on each side.",
width = 4,
height = 2
})
ix.container.Register("models/props_interiors/furniture_desk01a.mdl", {
name = "Wooden Desk",
description = "A medium-sized wooden desk with four small drawers and two large ones on each side.",
width = 4,
height = 2
})
ix.container.Register("models/props_interiors/desk_metal.mdl", {
name = "Small Metal Desk",
description = "A small metal desk with an assortment of drawers.",
width = 2,
height = 3
})
ix.container.Register("models/props_office/desk_01.mdl", {
name = "Large Metal Desk",
description = "A large metal desk with two drawers on each side.",
width = 2,
height = 2
})
ix.container.Register("models/props_interiors/trashcan01.mdl", {
name = "Metal Trash Can",
description = "A large metal trash can, used for disposing trash.",
width = 3,
height = 7
})
ix.container.Register("models/props_street/trashbin01.mdl", {
name = "Trash Bin",
description = "A large plastic trash bin used for disposing trash.",
width = 3,
height = 8
})
ix.container.Register("models/props_trainstation/trashcan_indoor001a.mdl", {
name = "Trash Bin",
description = "A large metal trash bin used for disposing trash.",
width = 3,
height = 8
})
ix.container.Register("models/props/cs_office/trash_can.mdl", {
name = "Small Trash Bin",
description = "A small plastic trash bin used for disposing trash.",
width = 2,
height = 2
})
ix.container.Register("models/props/cs_office/trash_can_p.mdl", {
name = "Small Trash Bin",
description = "A small plastic trash bin used for disposing trash.",
width = 2,
height = 2
})
ix.container.Register("models/props_interiors/paper_tray.mdl", {
name = "Paper Tray",
description = "A paper tray, used for storing pieces of paper.",
width = 1,
height = 10,
restriction = {"paper", "notepad", "pin"}
})
ix.container.Register("models/props/cs_office/file_box.mdl", {
name = "File Box",
description = "A file box, used for storing paper, notepads, and files.",
width = 9,
height = 1,
restriction = {"paper", "notepad"}
})
ix.container.Register("models/props/cs_office/file_box_p1.mdl", {
name = "File Box",
description = "A file box, used for storing paper, notepads, and files.",
width = 9,
height = 1,
restriction = {"paper", "notepad"}
})
ix.container.Register("models/props/cs_office/file_box_p2.mdl", {
name = "File Box",
description = "A file box, used for storing paper, notepads, and files.",
width = 9,
height = 1,
restriction = {"paper", "notepad"}
})
ix.util.Include("cl_hooks.lua")
ix.util.Include("sh_hooks.lua")
ix.util.Include("sv_hooks.lua")
function PLUGIN:InitializedPlugins()
ix.inventory.Register("toilet", 1, 1)
end
properties.Add("ixUsableEntityCreate", {
MenuLabel = "Make Usable",
Order = 401,
MenuIcon = "icon16/wand.png",
Filter = function(self, entity, client)
if (entity:GetClass() != "prop_physics") then return false end
if (!gamemode.Call("CanProperty", client, "ixUsableEntityCreate", entity)) then return false end
local model = string.lower(entity:GetModel())
if (!PLUGIN.usableEntityLookup[model]) then return false end
return true
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
local model = string.lower(entity:GetModel())
local entityClass = PLUGIN.usableEntityLookup[model].class
local usableEntity = ents.Create(entityClass)
usableEntity:SetPos(entity:GetPos())
usableEntity:SetAngles(entity:GetAngles())
usableEntity:SetModel(model)
usableEntity:Spawn()
entity:Remove()
ix.log.Add(client, "usableEntitySpawned", entityClass, model)
end
})

View File

@@ -0,0 +1,67 @@
--[[
| 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/
--]]
ix.log.AddType("usableEntitySpawned", function(client, ...)
local arg = {...}
return string.format("%s has spawned a usable entity class '%s' with model '%s'.", client:Name(), arg[1], arg[2])
end)
function PLUGIN:RegisterSaveEnts()
ix.saveEnts:RegisterEntity("ix_clock", true, true, true, {
OnSave = function(entity, data)
data.model = entity:GetModel()
end,
OnRestorePreSpawn = function(entity, data)
entity:SetModel(data.model)
end
})
ix.saveEnts:RegisterEntity("ix_lamp", true, true, true, {
OnSave = function(entity, data)
data.model = entity:GetModel()
end,
OnRestorePreSpawn = function(entity, data)
entity:SetModel(data.model)
end
})
ix.saveEnts:RegisterEntity("ix_toilet", true, true, true, {
OnSave = function(entity, data)
local inventory = ix.item.inventories[entity:GetNetVar("ID")]
data.invID = inventory:GetID()
data.model = entity:GetModel()
end,
OnRestore = function(entity, data)
ix.inventory.Restore(data.invID, 1, 1, function(inventory)
inventory.vars.isBag = true
if (IsValid(entity)) then
entity:SetNetVar("ID", inventory:GetID())
end
end)
end,
OnRestorePreSpawn = function(entity, data)
entity:SetModel(data.model)
end,
ShouldSave = function(entity)
local inventory = ix.item.inventories[entity:GetNetVar("ID")]
return inventory:GetID() >= 1
end,
ShouldRestore = function(data)
return data.invID >= 1
end
})
ix.saveEnts:RegisterEntity("ix_shop_sign", true, true, true, {
OnSave = function(entity, data) end
})
end