mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 21:53:46 +03:00
Upload
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
--[[
|
||||
| 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 PANEL = {}
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PANEL:Init()
|
||||
self.exit.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
self:Remove()
|
||||
end
|
||||
|
||||
self.titleText:SetText("Select Trash Items")
|
||||
self.titleText:SizeToContents()
|
||||
|
||||
self:CreateItems()
|
||||
end
|
||||
|
||||
function PANEL:CreateItems()
|
||||
local character = LocalPlayer():GetCharacter()
|
||||
if !character then return end
|
||||
|
||||
local inventory = character:GetInventory()
|
||||
if !inventory then return end
|
||||
|
||||
local scrollPanel = self.innerContent:Add("DScrollPanel")
|
||||
scrollPanel:Dock(TOP)
|
||||
scrollPanel:SetSize(self.innerContent:GetWide(), self.innerContent:GetTall() - SScaleMin(50 / 3))
|
||||
|
||||
for _, item in pairs(inventory:GetItemsByBase("base_junk")) do
|
||||
if table.HasValue(PLUGIN.disAllowedJunk, item.uniqueID) then continue end
|
||||
|
||||
local frame, modelPanel, textPanel, amountPanel = self:CreateItem(scrollPanel, item.uniqueID)
|
||||
local button = self:CreateInvisibleButton(frame, modelPanel, textPanel, amountPanel)
|
||||
button.DoClick = function()
|
||||
surface.PlaySound("helix/ui/press.wav")
|
||||
|
||||
if self.junkAmount == 5 then
|
||||
LocalPlayer():Notify("Bu makine çöplerle dolu!")
|
||||
return
|
||||
end
|
||||
|
||||
self.junkAmount = self.junkAmount + 1
|
||||
|
||||
frame:Remove()
|
||||
netstream.Start("ixTrashCollectorPlaceJunk", item.id, self.entIndex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
vgui.Register("ixTrashCollectorSelector", PANEL, "PickupDispenser")
|
||||
@@ -0,0 +1,91 @@
|
||||
--[[
|
||||
| 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')
|
||||
local glowMaterial = ix.util.GetMaterial("sprites/glow04_noz")
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel() -- Draw the model
|
||||
|
||||
local ang = self:GetAngles()
|
||||
local pos = self:GetPos() + ang:Up() * 65 + ang:Right() * -15.5 + ang:Forward() * -45
|
||||
ang:RotateAroundAxis(ang:Right(), 90)
|
||||
ang:RotateAroundAxis(ang:Up(), -90)
|
||||
|
||||
cam.Start3D2D( pos, ang, 0.1 )
|
||||
|
||||
local width, height = 285, 400
|
||||
|
||||
surface.SetDrawColor( Color( 16, 16, 16 ) )
|
||||
surface.DrawRect( 0, 0, width, height )
|
||||
|
||||
surface.SetDrawColor( Color( 255, 255, 255, 16 ) )
|
||||
surface.DrawRect( 0, height / 2 + math.sin( CurTime() * 4 ) * height / 2, width, 1 )
|
||||
|
||||
local alpha = 191 + 64 * math.sin( CurTime() * 4 )
|
||||
local color = ColorAlpha(self.Displays[self:GetDisplay()][2], alpha)
|
||||
|
||||
draw.SimpleText( "TRASH COLLECTOR", "TitlesFontFixed", width / 2, height * 0.5 - 16, Color( 255, 255, 255, alpha ), TEXT_ALIGN_CENTER )
|
||||
draw.SimpleText( self.Displays[self:GetDisplay()][1], "TitlesFontFixed", width / 2, height * 0.5 + 16, color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
|
||||
if (self.buttons) then
|
||||
if !self:GetUsed() then
|
||||
for k, _ in pairs(self.buttons) do
|
||||
local closest = self:GetNearestButton()
|
||||
local thisText = "Place Trash"
|
||||
if k == 2 then thisText = "Start Machine" end
|
||||
if (closest == k) then
|
||||
cam.Start3D2D( self.buttons[k], ang, 0.1 )
|
||||
draw.SimpleText( thisText, "MenuFont", 0, ((k == 2 or k == 3) and 30 or -30), Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
|
||||
cam.End3D2D()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cam.End3D2D()
|
||||
|
||||
render.SetMaterial(glowMaterial)
|
||||
|
||||
if (self.buttons) then
|
||||
local position = self:GetPos()
|
||||
local f, r, u = self:GetForward(), self:GetRight(), self:GetUp()
|
||||
|
||||
self.buttons[1] = position + f*-45.5 + r*20 + u*45
|
||||
self.buttons[2] = position + f*-45.5 + r*20 + u*38
|
||||
local closest = self:GetNearestButton()
|
||||
|
||||
for k, v in pairs(self.buttons) do
|
||||
local thisColor = self:GetUsed() and Color(255, 0, 0, 255) or k == 1 and Color(0, 255, 0, 255) or k == 2 and Color(150, 150, 0, 255)
|
||||
|
||||
if (closest != k) then
|
||||
thisColor.a = 75
|
||||
else
|
||||
thisColor.a = 230 + (math.sin(RealTime() * 7.5) * 25)
|
||||
end
|
||||
|
||||
if (LocalPlayer():KeyDown(IN_USE) and closest == k) then
|
||||
thisColor = table.Copy(thisColor)
|
||||
thisColor.r = math.min(thisColor.r + 100, 255)
|
||||
thisColor.g = math.min(thisColor.g + 100, 255)
|
||||
thisColor.b = math.min(thisColor.b + 100, 255)
|
||||
end
|
||||
|
||||
render.DrawSprite(v, 10, 10, thisColor)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
netstream.Hook("ixTrashCollectorSelector", function(entIndex, junkAmount)
|
||||
local selector = vgui.Create("ixTrashCollectorSelector")
|
||||
selector.entIndex = entIndex
|
||||
selector.junkAmount = junkAmount
|
||||
end)
|
||||
@@ -0,0 +1,228 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
|
||||
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
|
||||
|
||||
include('shared.lua')
|
||||
|
||||
function ENT:Initialize()
|
||||
self:SetModel( "models/fruity/combine_tptimer_edit.mdl" )
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:PhysicsInit( SOLID_VPHYSICS )
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self:SetAngles(self:GetAngles() + Angle(0, 180, 0))
|
||||
self.canUse = true
|
||||
|
||||
self.bin = ents.Create("prop_dynamic")
|
||||
self.bin:SetPos(self:GetPos() + self:GetForward() * -67.2 + self:GetRight() * -1.6)
|
||||
self.bin:SetAngles(self:GetAngles() + Angle(0, 180, 0))
|
||||
self.bin:SetModel("models/props/de_vostok/hardwarebina.mdl")
|
||||
self.bin:Activate()
|
||||
self.bin:SetParent(self)
|
||||
self.bin:SetModelScale(4.3)
|
||||
self.bin:DeleteOnRemove(self)
|
||||
self.bin:SetMaterial("models/props_combine/combine_barricade_tall02b.vmt")
|
||||
|
||||
self.spark = ents.Create("env_spark")
|
||||
|
||||
local lifter = ents.Create("prop_dynamic")
|
||||
lifter:SetPos(self:GetPos() + self:GetForward() * -70.2 + self:GetRight() * -1.5)
|
||||
lifter:SetAngles(self:GetAngles() + Angle(0, 180, 0))
|
||||
lifter:SetModel("models/fruity/trash_collector_lifter.mdl")
|
||||
lifter:Activate()
|
||||
lifter:SetParent(self)
|
||||
lifter:Spawn()
|
||||
lifter:DeleteOnRemove(self)
|
||||
lifter:SetMaterial("models/props_combine/combine_barricade_tall02b.vmt")
|
||||
|
||||
local physics = self:GetPhysicsObject()
|
||||
physics:EnableMotion(false)
|
||||
physics:Wake()
|
||||
|
||||
self:SetDisplay(1)
|
||||
self.junkAmount = 0
|
||||
self.junk = {}
|
||||
self:SetUsed(false)
|
||||
|
||||
ix.saveEnts:SaveEntity(self)
|
||||
PLUGIN:SaveTrashCollectors()
|
||||
end
|
||||
|
||||
function ENT:Use(client)
|
||||
local button = self:GetNearestButton(client)
|
||||
if (button) then
|
||||
if self:GetUsed() then return false end
|
||||
|
||||
if button == 1 then
|
||||
self:EmitSound("buttons/button6.wav")
|
||||
netstream.Start(client, "ixTrashCollectorSelector", self:EntIndex(), self.junkAmount)
|
||||
else
|
||||
if self.junkAmount <= 0 then self:EmitSound("buttons/button2.wav") return false end
|
||||
self:SetUsed(true)
|
||||
self:MoveBin()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:OnRemove()
|
||||
self:StopSound("ambient/machines/engine1.wav")
|
||||
self:StopSound("ambient/levels/canals/manhack_machine_loop1.wav")
|
||||
end
|
||||
|
||||
function ENT:PlaceJunk(model, client)
|
||||
self.junkAmount = self.junkAmount + 1
|
||||
local junkEnt = ents.Create("prop_dynamic")
|
||||
junkEnt:SetPos(self.bin:GetPos() + Vector(0, 0, 15))
|
||||
junkEnt:SetAngles(self.bin:GetAngles() + Angle(0, 90, 0))
|
||||
junkEnt:SetModel(model)
|
||||
junkEnt:Activate()
|
||||
junkEnt:SetParent(self.bin)
|
||||
junkEnt:Spawn()
|
||||
|
||||
self.bin:DeleteOnRemove(junkEnt)
|
||||
|
||||
self.junk[#self.junk + 1] = junkEnt
|
||||
self:EmitSound("physics/cardboard/cardboard_box_impact_hard5.wav")
|
||||
end
|
||||
|
||||
netstream.Hook("ixTrashCollectorPlaceJunk", function(client, itemID, entIndex)
|
||||
local item = ix.item.instances[itemID]
|
||||
if !item then return end
|
||||
local character = client:GetCharacter()
|
||||
if !character then return end
|
||||
|
||||
local inventory = character:GetInventory()
|
||||
if !inventory then return end
|
||||
|
||||
if !inventory:GetItemByID(itemID) then return end
|
||||
local model = item.model or false
|
||||
|
||||
if !Entity(entIndex) then return end
|
||||
if !IsValid(Entity(entIndex)) then return end
|
||||
if !model then return end
|
||||
|
||||
if Entity(entIndex).junkAmount == 5 then
|
||||
client:Notify("Bu makine çöplerle dolu!")
|
||||
return
|
||||
end
|
||||
|
||||
if Entity(entIndex):GetUsed() then
|
||||
client:Notify("Bu makine devam ediyor!")
|
||||
return false
|
||||
end
|
||||
|
||||
item:Remove()
|
||||
Entity(entIndex):PlaceJunk(model, client)
|
||||
end)
|
||||
|
||||
function ENT:MoveBin()
|
||||
self:SetDisplay(2)
|
||||
self:ResetSequence(self:LookupSequence("30sec"))
|
||||
self:EmitSound("buttons/lightswitch2.wav")
|
||||
local upCount, maxUpCount = 0, 3.6
|
||||
local inCount, maxInCount = 0, 3.4
|
||||
local outCount, maxOutCount, minOutCount = -10, 3.3, -10
|
||||
local downCount, maxDownCount = 0, 2.6
|
||||
local startPos = self.bin:GetPos()
|
||||
self:EmitSound("buttons/combine_button5.wav")
|
||||
self:EmitSound("ambient/machines/engine1.wav")
|
||||
|
||||
timer.Create("ixTrashCollectorBinMove_"..self:EntIndex(), 0.1, 0, function()
|
||||
if IsValid(self.bin) then
|
||||
upCount = math.Clamp(upCount + 0.1, 0, maxUpCount)
|
||||
if upCount == maxUpCount then
|
||||
if inCount == maxInCount then
|
||||
if outCount == maxOutCount then
|
||||
if downCount == maxDownCount then
|
||||
-- Reset
|
||||
timer.Remove("ixTrashCollectorBinMove_"..self:EntIndex())
|
||||
self.bin:SetPos(startPos)
|
||||
self.bin:Respawn()
|
||||
self:StopSound("ambient/machines/engine1.wav")
|
||||
self:EmitSound("buttons/button3.wav")
|
||||
self:ResetSequence(self:LookupSequence("idle"))
|
||||
self:SetDisplay(4)
|
||||
timer.Simple(1, function()
|
||||
self:SetDisplay(1)
|
||||
self:SetUsed(false)
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- Down
|
||||
self.bin:SetPos(self.bin:GetPos() + Vector(0, 0, -(1 + downCount)))
|
||||
self.bin:Respawn()
|
||||
|
||||
downCount = math.Clamp(downCount + 0.1, 0, maxDownCount)
|
||||
return
|
||||
end
|
||||
|
||||
if outCount >= 0 then
|
||||
self.bin:SetPos(self.bin:GetPos() + self:GetForward() * -(1 + outCount))
|
||||
self.bin:Respawn()
|
||||
end
|
||||
|
||||
-- Out
|
||||
|
||||
if outCount == -10 or math.Round(outCount, 1) == -5 or math.Round(outCount, 1) == 0 then
|
||||
if outCount == -10 then
|
||||
self:StopSound("ambient/machines/engine1.wav")
|
||||
self:EmitSound("ambient/levels/canals/manhack_machine_loop1.wav")
|
||||
self.spark:SetPos(self.bin:GetPos())
|
||||
|
||||
for key, v in pairs(self.junk) do
|
||||
self.junk[key] = nil
|
||||
v:Remove()
|
||||
end
|
||||
|
||||
self.junkAmount = 0
|
||||
end
|
||||
|
||||
self.spark:Fire("SparkOnce")
|
||||
end
|
||||
|
||||
if math.Round(outCount, 1) == 0 then
|
||||
self:StopSound("ambient/levels/canals/manhack_machine_loop1.wav")
|
||||
self:EmitSound("ambient/machines/engine1.wav")
|
||||
end
|
||||
|
||||
outCount = math.Clamp(outCount + 0.1, minOutCount, maxOutCount)
|
||||
return
|
||||
end
|
||||
|
||||
-- In
|
||||
self.bin:SetPos(self.bin:GetPos() + self:GetForward() * (1 + inCount))
|
||||
self.bin:Respawn()
|
||||
|
||||
inCount = math.Clamp(inCount + 0.1, 0, maxInCount)
|
||||
return
|
||||
end
|
||||
|
||||
-- Up
|
||||
self.bin:SetPos(self.bin:GetPos() + Vector(0, 0, upCount))
|
||||
self.bin:Respawn()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
ENT.AutomaticFrameAdvance = true -- Must be set on client
|
||||
|
||||
function ENT:Think()
|
||||
-- Do stuff
|
||||
|
||||
self:NextThink( CurTime() ) -- Set the next think to run as soon as possible, i.e. the next frame.
|
||||
return true -- Apply NextThink call
|
||||
end
|
||||
@@ -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/
|
||||
--]]
|
||||
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Base = "base_gmodentity"
|
||||
|
||||
ENT.PrintName = "Trash Collector"
|
||||
ENT.Author = "Fruity"
|
||||
ENT.Contact = ""
|
||||
ENT.Purpose = ""
|
||||
ENT.Instructions = "Fruitybooty"
|
||||
|
||||
ENT.Category = "HL2 RP"
|
||||
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
|
||||
ENT.buttons = {}
|
||||
ENT.disAllowedJunk = {
|
||||
"junk_pc_monitor",
|
||||
"junk_frame",
|
||||
"trash_biolock",
|
||||
"junk_cardboard"
|
||||
}
|
||||
|
||||
ENT.Displays = {
|
||||
[1] = {"WAITING FOR TRASH", Color( 255, 255, 180 )},
|
||||
[2] = {"IN PROGRESS", Color( 255, 255, 180 )},
|
||||
[3] = {"SELECTING JUNK", Color( 180, 255, 180 )},
|
||||
[4] = {"SUCCESS", Color( 0, 255, 0 )}
|
||||
}
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:NetworkVar("Int", 0, "Display")
|
||||
self:NetworkVar("Bool", 0, "Used")
|
||||
end
|
||||
|
||||
function ENT:GetNearestButton(client)
|
||||
client = client or (CLIENT and LocalPlayer())
|
||||
|
||||
if (self.buttons) then
|
||||
if (SERVER) then
|
||||
local position = self:GetPos()
|
||||
local f, r, u = self:GetForward(), self:GetRight(), self:GetUp()
|
||||
|
||||
self.buttons[1] = position + f*-45.5 + r*20 + u*45
|
||||
self.buttons[2] = position + f*-45.5 + r*20 + u*38
|
||||
end
|
||||
|
||||
local data = {}
|
||||
data.start = client:GetShootPos()
|
||||
data.endpos = data.start + client:GetAimVector()*96
|
||||
data.filter = client
|
||||
local trace = util.TraceLine(data)
|
||||
local hitPos = trace.HitPos
|
||||
|
||||
if (hitPos) then
|
||||
for k, v in pairs(self.buttons) do
|
||||
if (v:Distance(hitPos) <= 2) then
|
||||
return k
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
25
gamemodes/darkrp/plugins/trashcollector/sh_plugin.lua
Normal file
25
gamemodes/darkrp/plugins/trashcollector/sh_plugin.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/
|
||||
--]]
|
||||
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
PLUGIN.name = "Trash Collector"
|
||||
PLUGIN.author = "Fruity"
|
||||
PLUGIN.description = "Press E and throw empty cans and misc trash away."
|
||||
|
||||
PLUGIN.disAllowedJunk = {
|
||||
"junk_pc_monitor",
|
||||
"junk_frame",
|
||||
"trash_biolock",
|
||||
"junk_cardboard"
|
||||
}
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
55
gamemodes/darkrp/plugins/trashcollector/sv_plugin.lua
Normal file
55
gamemodes/darkrp/plugins/trashcollector/sv_plugin.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
--[[
|
||||
| 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
|
||||
|
||||
function PLUGIN:RegisterSaveEnts()
|
||||
ix.saveEnts:RegisterEntity("ix_trashcollector", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
return {pos = data.pos, angles = data.angles + Angle(0, 180, 0), motion = false}
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function PLUGIN:SaveTrashCollectors()
|
||||
local trashcollectors = {}
|
||||
|
||||
for _, v in pairs(ents.FindByClass("ix_trashcollector")) do
|
||||
trashcollectors[#trashcollectors + 1] = {
|
||||
angles = v:GetAngles(),
|
||||
position = v:GetPos()
|
||||
}
|
||||
end
|
||||
|
||||
ix.data.Set("trashcollectors", trashcollectors)
|
||||
end
|
||||
|
||||
function PLUGIN:LoadTrashCollectors()
|
||||
if (!ix.config.Get("SaveEntsOldLoadingEnabled")) then return end
|
||||
|
||||
local trashcollectors = ix.data.Get("trashcollectors")
|
||||
if trashcollectors then
|
||||
for _, v in pairs(trashcollectors) do
|
||||
local entity = ents.Create("ix_trashcollector")
|
||||
entity:SetAngles(v.angles + Angle(0, 180, 0))
|
||||
entity:SetPos(v.position)
|
||||
entity:Spawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function PLUGIN:SaveData()
|
||||
self:SaveTrashCollectors()
|
||||
end
|
||||
|
||||
function PLUGIN:InitPostEntity()
|
||||
self:LoadTrashCollectors()
|
||||
end
|
||||
Reference in New Issue
Block a user