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,30 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
|
||||
function ENT:OnPopulateEntityInfo(container)
|
||||
local name = container:AddRow("name")
|
||||
name:SetImportant()
|
||||
name:SetText("Trash")
|
||||
name:SizeToContents()
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
|
||||
end
|
||||
@@ -0,0 +1,156 @@
|
||||
--[[
|
||||
| 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")
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function ENT:Initialize()
|
||||
local garbageModels = {
|
||||
"models/willardnetworks/props/trash01.mdl",
|
||||
"models/willardnetworks/props/trash02.mdl",
|
||||
"models/willardnetworks/props/trash03.mdl"
|
||||
}
|
||||
self.items = {}
|
||||
for i, itemTable in pairs(ix.item.list) do
|
||||
if (itemTable.category == "Déchets") then
|
||||
self.items[i] = itemTable
|
||||
end
|
||||
end
|
||||
self:SetModel(table.Random(garbageModels))
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WORLD)
|
||||
local phys = self:GetPhysicsObject()
|
||||
phys:SetMass( 120 )
|
||||
self.alive = true
|
||||
end
|
||||
|
||||
function ENT:UpdateTransmitState()
|
||||
return TRANSMIT_PVS
|
||||
end
|
||||
|
||||
function ENT:PhysicsUpdate(physicsObject)
|
||||
if (!self:IsPlayerHolding() and !self:IsConstrained()) then
|
||||
physicsObject:SetVelocity( Vector(0, 0, 0) )
|
||||
physicsObject:Sleep()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator, caller)
|
||||
if (activator:IsPlayer() and activator:GetEyeTraceNoCursor().Entity == self) then
|
||||
local char = activator:GetCharacter()
|
||||
if (istable(char)) then
|
||||
local cooldown = char:GetTrashCooldownTime()
|
||||
if (cooldown > 0) then
|
||||
activator:NotifyLocalized("You cannot search the trash for "..tostring(cooldown).." more seconds.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if (activator:Crouching()) then
|
||||
if (!self.alive) then
|
||||
activator:NotifyLocalized("Someone else is already cleaning the trash!")
|
||||
return
|
||||
else
|
||||
self.alive = false
|
||||
end
|
||||
local trashSearchTime = char:GetActionTimeInfluencedByEnergyLevel(ix.config.Get("Trash Search Time", 10))
|
||||
activator:SetAction(
|
||||
"Vous fouillez les poubelles...", trashSearchTime, function()
|
||||
local character = activator:GetCharacter()
|
||||
if (!istable(character)) then
|
||||
return
|
||||
end
|
||||
local attempts = char:GetTrashCooldownWindowAttempts()
|
||||
char:SetTrashCooldownWindowAttempts(attempts + 1)
|
||||
|
||||
activator.searchingGarbage = true
|
||||
activator:EmitSound("physics/body/body_medium_impact_soft" .. math.random(1, 7) .. ".wav")
|
||||
|
||||
local chance = math.random(0, 100)
|
||||
local minPly, maxPly = ix.config.Get("Trash Min Players"), ix.config.Get("Trash Max Players")
|
||||
local required = math.Remap(math.Clamp(#player.GetAll(), minPly, maxPly), minPly, maxPly, ix.config.Get("Trash Min Chance"), ix.config.Get("Trash Max Chance"))
|
||||
|
||||
if (chance <= required) then
|
||||
local multiplier = ix.config.Get("Trash Search Multiplier")
|
||||
local max = ix.config.Get("Trash Search Max Items")
|
||||
local targetInventory = character:GetInventory()
|
||||
|
||||
if (!targetInventory) then return end
|
||||
|
||||
local numItems = math.Round(math.random(1, max) * (math.random(0.0, 0.75) * multiplier))
|
||||
|
||||
if (numItems > max) then
|
||||
numItems = max
|
||||
elseif (numItems < 1) then
|
||||
numItems = 1
|
||||
end
|
||||
|
||||
if (self.items) then
|
||||
for i = numItems,1,-1 do
|
||||
local item = table.Random(self.items)
|
||||
|
||||
if (item) then
|
||||
if (targetInventory:Add(item.uniqueID, 1)) then
|
||||
local name = string.lower(item.name)
|
||||
local text = "Vous avez trouvé: " .. '"' .. name .. '"' .. "."
|
||||
activator:NotifyLocalized(text)
|
||||
else
|
||||
ix.item.Spawn(item.uniqueID, activator)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
activator:NotifyLocalized("Vous n'avez rien trouvé.")
|
||||
end
|
||||
|
||||
if (self and self:IsValid()) then
|
||||
activator.searchingGarbage = nil
|
||||
|
||||
self:Remove()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local uniqueID = "CheckIfStillSearching_" .. activator:SteamID64()
|
||||
timer.Create(uniqueID, 0.5, 0, function()
|
||||
if (IsValid(activator)) then
|
||||
if (IsValid(self) and IsValid(self:GetPhysicsObject())) then
|
||||
if (self:GetPos():DistToSqr(activator:GetPos()) > 2500 or !activator:Crouching()) then
|
||||
activator:SetAction(false)
|
||||
activator.searchingGarbage = nil
|
||||
self.alive = true
|
||||
timer.Remove(uniqueID)
|
||||
activator:NotifyLocalized("Vous êtes trop éloigné de la poubelle.")
|
||||
end
|
||||
elseif (activator.searchingGarbage) then
|
||||
activator:SetAction(false)
|
||||
activator.searchingGarbage = nil
|
||||
timer.Remove(uniqueID)
|
||||
activator:NotifyLocalized("The trash was removed before you could finish searching.")
|
||||
end
|
||||
else
|
||||
if (IsValid(self)) then self.alive = true end
|
||||
timer.Remove(uniqueID)
|
||||
end
|
||||
end)
|
||||
else
|
||||
activator:NotifyLocalized("Vous devez vous accroupir pour fouillez les poubelles.")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:CanTool(player, trace, tool)
|
||||
return false
|
||||
end
|
||||
@@ -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/
|
||||
--]]
|
||||
|
||||
DEFINE_BASECLASS("base_gmodentity")
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
TYPE_WATERCAN = 0
|
||||
TYPE_SUPPLIES = 1
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Author = "M!NT, Fruity"
|
||||
ENT.PrintName = "Trash Pile"
|
||||
ENT.Contact = "Willard Networks"
|
||||
ENT.Purpose = "Lootable trash pile."
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
|
||||
function ENT:SetupDataTables()
|
||||
self:DTVar("Int", 0, "index")
|
||||
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/
|
||||
--]]
|
||||
|
||||
include("shared.lua")
|
||||
|
||||
function ENT:Draw()
|
||||
self:DrawModel()
|
||||
end
|
||||
@@ -0,0 +1,83 @@
|
||||
--[[
|
||||
| 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_junk/Shoe001a.mdl")
|
||||
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||
self:PhysicsInit(SOLID_VPHYSICS)
|
||||
self:SetUseType(SIMPLE_USE)
|
||||
self:SetSolid(SOLID_VPHYSICS)
|
||||
self:SetCollisionGroup(COLLISION_GROUP_WORLD)
|
||||
self:SetNoDraw(true)
|
||||
local phys = self:GetPhysicsObject()
|
||||
phys:SetMass(120)
|
||||
|
||||
self:SetupNextSpawn()
|
||||
|
||||
self:CallOnRemove(
|
||||
"KillParentTimer",
|
||||
function(ent)
|
||||
ent.dead = true
|
||||
timer.Remove("spawner_trash_"..ent:EntIndex())
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:SetupNextSpawn()
|
||||
if (self.dead) then return end
|
||||
|
||||
local variation = ix.config.Get("Trash Spawner Respawn Variation") * 60
|
||||
local duration = math.max(ix.config.Get("Trash Spawner Respawn Time") * 60 + math.random(-variation, variation), 60)
|
||||
self:SetNetVar("ixNextTrashSpawn", CurTime() + duration)
|
||||
|
||||
local uniqueID = "spawner_trash_"..self:EntIndex()
|
||||
if (timer.Exists(uniqueID)) then timer.Remove(uniqueID) end
|
||||
|
||||
timer.Create(uniqueID, duration, 1, function()
|
||||
if (IsValid(self)) then
|
||||
self:SetNetVar("ixNextTrashSpawn", -1)
|
||||
self.trashEnt = ents.Create("ix_garbage")
|
||||
if (IsValid(self.trashEnt)) then
|
||||
self.trashEnt:SetPos(self:GetPos())
|
||||
self.trashEnt.ixSpawner = self
|
||||
self.trashEnt:Spawn()
|
||||
self.trashEnt:CallOnRemove(
|
||||
"RestartTrashTimer",
|
||||
function(ent)
|
||||
if (IsValid(ent.ixSpawner)) then
|
||||
ent.ixSpawner:SetupNextSpawn()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function ENT:UpdateTransmitState()
|
||||
return TRANSMIT_PVS
|
||||
end
|
||||
|
||||
function ENT:PhysicsUpdate(physicsObject)
|
||||
if (!self:IsPlayerHolding() and !self:IsConstrained()) then
|
||||
physicsObject:SetVelocity( Vector(0, 0, 0) )
|
||||
physicsObject:Sleep()
|
||||
end
|
||||
end
|
||||
|
||||
function ENT:Use(activator, caller)
|
||||
return
|
||||
end
|
||||
|
||||
function ENT:CanTool(player, trace, tool)
|
||||
return false
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
DEFINE_BASECLASS("base_gmodentity")
|
||||
|
||||
ENT.Type = "anim"
|
||||
ENT.Author = "M!NT, Fruity"
|
||||
ENT.PrintName = "Endless Trash"
|
||||
ENT.Contact = "Willard Networks"
|
||||
ENT.Purpose = "Spawns trash"
|
||||
ENT.Spawnable = true
|
||||
ENT.AdminOnly = true
|
||||
ENT.PhysgunDisable = true
|
||||
ENT.bNoPersist = true
|
||||
Reference in New Issue
Block a user