mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
25
gamemodes/helix/plugins/usableentities/cl_hooks.lua
Normal file
25
gamemodes/helix/plugins/usableentities/cl_hooks.lua
Normal 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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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")
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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")
|
||||
@@ -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 == "Ouvrir") then
|
||||
local inventory = ix.item.inventories[self:GetNetVar("ID")]
|
||||
|
||||
if (inventory) then
|
||||
ix.storage.Open(client, inventory, {
|
||||
name = "Toilette",
|
||||
entity = self,
|
||||
searchTime = 1
|
||||
})
|
||||
end
|
||||
elseif (option == "Chasse d'eau") 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
|
||||
@@ -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 = "Toilette"
|
||||
ENT.Spawnable = false
|
||||
ENT.bNoPersist = true
|
||||
|
||||
function ENT:GetEntityMenu(client)
|
||||
return {["Ouvrir"] = true, ["Chasse d'eau"] = true}
|
||||
end
|
||||
|
||||
23
gamemodes/helix/plugins/usableentities/sh_hooks.lua
Normal file
23
gamemodes/helix/plugins/usableentities/sh_hooks.lua
Normal 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
|
||||
207
gamemodes/helix/plugins/usableentities/sh_plugin.lua
Normal file
207
gamemodes/helix/plugins/usableentities/sh_plugin.lua
Normal file
@@ -0,0 +1,207 @@
|
||||
--[[
|
||||
| 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 = "Rend certaines entités réellement utilisables."
|
||||
|
||||
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_office/bookshelf1.mdl", {
|
||||
name = "Bibliothèque",
|
||||
description = "Une bibliothèque avec cinq étagères.",
|
||||
width = 4,
|
||||
height = 5,
|
||||
restriction = {"book"}
|
||||
})
|
||||
|
||||
ix.container.Register("models/props/cs_office/bookshelf2.mdl", {
|
||||
name = "Bibliothèque",
|
||||
description = "Une bibliothèque avec cinq étagères.",
|
||||
width = 4,
|
||||
height = 5,
|
||||
restriction = {"book"}
|
||||
})
|
||||
|
||||
ix.container.Register("models/props/cs_office/bookshelf3.mdl", {
|
||||
name = "Bibliothèque",
|
||||
description = "Une bibliothèque avec cinq étagères.",
|
||||
width = 4,
|
||||
height = 5,
|
||||
restriction = {"book"}
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_interiors/desk_executive.mdl", {
|
||||
name = "Bureau en bois",
|
||||
description = "Un grand bureau en bois avec quatre petits tiroirs de chaque côté.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_combine/breendesk.mdl", {
|
||||
name = "Bureau en bois",
|
||||
description = "Un grand bureau en bois avec quatre petits tiroirs de chaque côté.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_furniture/desk1.mdl", {
|
||||
name = "Bureau en bois",
|
||||
description = "Un bureau en bois de taille moyenne avec quatre petits tiroirs et deux grands de chaque côté.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_interiors/furniture_desk01a.mdl", {
|
||||
name = "Bureau en bois",
|
||||
description = "Un bureau en bois de taille moyenne avec quatre petits tiroirs et deux grands de chaque côté.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_interiors/desk_metal.mdl", {
|
||||
name = "Bureau en métal",
|
||||
description = "Un petit bureau en métal avec un assortiment de tiroirs.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_office/desk_01.mdl", {
|
||||
name = "Bureau en métal",
|
||||
description = "Un petit bureau en métal avec un assortiment de tiroirs.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_street/trashbin01.mdl", {
|
||||
name = "Poubelle",
|
||||
description = "Une grande poubelle en plastique utilisée pour jeter les déchets.",
|
||||
width = 3,
|
||||
height = 8
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_trainstation/trashcan_indoor001a.mdl", {
|
||||
name = "Poubelle",
|
||||
description = "Une grande poubelle en métal utilisée pour jeter les déchets.",
|
||||
width = 3,
|
||||
height = 3
|
||||
})
|
||||
|
||||
ix.container.Register("models/props/cs_office/trash_can.mdl", {
|
||||
name = "Petite poubelle",
|
||||
description = "Une petite poubelle en plastique utilisée pour jeter les déchets.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props/cs_office/trash_can_p.mdl", {
|
||||
name = "Petite poubelle",
|
||||
description = "Une petite poubelle en plastique utilisée pour jeter les déchets.",
|
||||
width = 2,
|
||||
height = 2
|
||||
})
|
||||
|
||||
ix.container.Register("models/props_interiors/paper_tray.mdl", {
|
||||
name = "Bac à papier",
|
||||
description = "Un bac à papier, utilisé pour stocker des morceaux de papier.",
|
||||
width = 1,
|
||||
height = 10,
|
||||
restriction = {"paper"}
|
||||
})
|
||||
|
||||
ix.container.Register("models/props/cs_office/file_box.mdl", {
|
||||
name = "Boîte à dossiers",
|
||||
description = "Une boîte à dossiers, utilisée pour stocker du papier, des blocs-notes et des dossiers.",
|
||||
width = 9,
|
||||
height = 1,
|
||||
restriction = {"paper", "notepad"}
|
||||
})
|
||||
|
||||
ix.container.Register("models/props/cs_office/file_box_p1.mdl", {
|
||||
name = "Boîte à dossiers",
|
||||
description = "Une boîte à dossiers, utilisée pour stocker du papier, des blocs-notes et des dossiers.",
|
||||
width = 9,
|
||||
height = 1,
|
||||
restriction = {"paper", "notepad"}
|
||||
})
|
||||
|
||||
ix.container.Register("models/props/cs_office/file_box_p2.mdl", {
|
||||
name = "Boîte à dossiers",
|
||||
description = "Une boîte à dossiers, utilisée pour stocker du papier, des blocs-notes et des dossiers.",
|
||||
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 = "Devenir utilisable",
|
||||
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
|
||||
})
|
||||
67
gamemodes/helix/plugins/usableentities/sv_hooks.lua
Normal file
67
gamemodes/helix/plugins/usableentities/sv_hooks.lua
Normal 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 a fait spawn l'entité '%s' avec le 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
|
||||
Reference in New Issue
Block a user