mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +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("Çöp")
|
||||
name:SizeToContents()
|
||||
end
|
||||
|
||||
function ENT:Initialize()
|
||||
|
||||
end
|
||||
|
||||
function ENT:Think()
|
||||
|
||||
end
|
||||
@@ -0,0 +1,183 @@
|
||||
--[[
|
||||
| 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 == "Junk") 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("Çöpü "..tostring(cooldown).." saniye boyunca karıştıramazsınız.")
|
||||
return
|
||||
end
|
||||
end
|
||||
if (activator:Crouching()) then
|
||||
if (!self.alive) then
|
||||
activator:NotifyLocalized("Başka biri zaten çöpü temizliyor!")
|
||||
return
|
||||
else
|
||||
self.alive = false
|
||||
end
|
||||
local trashSearchTime = char:GetActionTimeInfluencedByEnergyLevel(ix.config.Get("Trash Search Time", 10))
|
||||
|
||||
local filter = RecipientFilter()
|
||||
filter:AddPVS(self:GetPos())
|
||||
|
||||
self.trashSound = CreateSound(self, "wn_trashbags/trash_search.wav", filter)
|
||||
self.trashSound:Play()
|
||||
|
||||
activator:SetAction(
|
||||
"Çöpü karıştırıyorsunuz...", trashSearchTime, function()
|
||||
local character = activator:GetCharacter()
|
||||
if (!istable(character)) then
|
||||
return
|
||||
end
|
||||
local attempts = char:GetTrashCooldownWindowAttempts()
|
||||
char:SetTrashCooldownWindowAttempts(attempts + 1)
|
||||
|
||||
if self.trashSound then
|
||||
self.trashSound:Stop()
|
||||
self.trashSound = nil
|
||||
end
|
||||
|
||||
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 = '"' .. name .. '"' .. " buldun."
|
||||
activator:NotifyLocalized(text)
|
||||
else
|
||||
ix.item.Spawn(item.uniqueID, activator)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
activator:NotifyLocalized("Hiçbir şey bulamadın.")
|
||||
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("Çöpten uzaklaştınız ve aramayı bıraktınız.")
|
||||
|
||||
if self.trashSound then
|
||||
self.trashSound:Stop()
|
||||
self.trashSound = nil
|
||||
end
|
||||
end
|
||||
elseif (activator.searchingGarbage) then
|
||||
activator:SetAction(false)
|
||||
activator.searchingGarbage = nil
|
||||
timer.Remove(uniqueID)
|
||||
activator:NotifyLocalized("Siz aramayı bitiremeden çöp kutusu kaldırıldı.")
|
||||
|
||||
if self.trashSound then
|
||||
self.trashSound:Stop()
|
||||
self.trashSound = nil
|
||||
end
|
||||
end
|
||||
else
|
||||
if (IsValid(self)) then self.alive = true end
|
||||
timer.Remove(uniqueID)
|
||||
|
||||
if self.trashSound then
|
||||
self.trashSound:Stop()
|
||||
self.trashSound = nil
|
||||
end
|
||||
end
|
||||
end)
|
||||
else
|
||||
activator:NotifyLocalized("Çöpü karıştırmak için çömelmeniz gerekir.")
|
||||
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
|
||||
148
gamemodes/darkrp/plugins/willardtrash/sh_plugin.lua
Normal file
148
gamemodes/darkrp/plugins/willardtrash/sh_plugin.lua
Normal file
@@ -0,0 +1,148 @@
|
||||
--[[
|
||||
| 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 = "Junk Items"
|
||||
PLUGIN.author = "M!NT, Fruity"
|
||||
PLUGIN.description = "Allow players to search trash for junk items."
|
||||
|
||||
ix.config.Add(
|
||||
"Trash Search Time",
|
||||
10,
|
||||
"The amount of seconds it takes for someone to search through garbage.",
|
||||
nil,
|
||||
{
|
||||
data = {min = 1, max = 60},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
|
||||
ix.config.Add("Trash Min Players", 10, "Chance someone has of finding something in trash piles", nil, {
|
||||
data = {min = 1, max = 20},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add("Trash Max Players", 40, "Chance someone has of finding something in trash piles", nil, {
|
||||
data = {min = 21, max = 100},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add("Trash Min Chance", 40, "Chance someone has of finding something in trash piles", nil, {
|
||||
data = {min = 1, max = 100},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add("Trash Max Chance", 80, "Chance someone has of finding something in trash piles", nil, {
|
||||
data = {min = 1, max = 100},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add("Trash Cooldown Threshold", 5, "How many consecutive trash searches it requires until someone gets placed onto trash searching cooldown.", nil, {
|
||||
data = {min = 1, max = 100},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add("Trash Cooldown Window", 240, "If someone searches x (threshold) amount of trash entities in this window (in seconds), they are put in cooldown.", nil, {
|
||||
data = {min = 1, max = 3600},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add("Trash Cooldown Time", 3600, "How long (in seconds) someone is put on cooldown for", nil, {
|
||||
data = {min = 1, max = 7200},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add(
|
||||
"Trash Search Multiplier",
|
||||
0.75,
|
||||
"Multiplies the chance of finding multiple items in the trash",
|
||||
nil,
|
||||
{
|
||||
data = {min = 0.0, max = 3.0, decimals = 2},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add(
|
||||
"Trash Search Max Items",
|
||||
3,
|
||||
"Maximum amount of items that can be found in the trash",
|
||||
nil,
|
||||
{
|
||||
data = {min = 1, max = 10},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
ix.config.Add(
|
||||
"Trash Spawner Respawn Time",
|
||||
60,
|
||||
"On average, how many minutes there should be in between trash spawns.",
|
||||
nil,
|
||||
{
|
||||
data = {min = 1, max = 240},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
|
||||
ix.config.Add(
|
||||
"Trash Spawner Respawn Variation",
|
||||
30,
|
||||
"How many minutes of variation there should be in the spawning.",
|
||||
nil,
|
||||
{
|
||||
data = {min = 1, max = 240},
|
||||
category = "Trash"
|
||||
}
|
||||
)
|
||||
|
||||
ix.util.Include("sv_plugin.lua")
|
||||
|
||||
ix.char.RegisterVar("trashCooldownWindowAttempts", {
|
||||
field = "trashCooldownWindowAttempts",
|
||||
fieldType = ix.type.number,
|
||||
default = 0,
|
||||
bNoDisplay = true,
|
||||
isLocal = true
|
||||
})
|
||||
|
||||
ix.char.RegisterVar("trashCooldownTime", {
|
||||
field = "trashCooldownTime",
|
||||
fieldType = ix.type.number,
|
||||
default = 0,
|
||||
bNoDisplay = true,
|
||||
isLocal = true
|
||||
})
|
||||
|
||||
if (CLIENT) then
|
||||
function PLUGIN:InitializedPlugins()
|
||||
local color = Color(120,0,240)
|
||||
local function drawTrashESP(client, entity, x, y, factor)
|
||||
local text = ""
|
||||
local nextSpawn = entity:GetNetVar("ixNextTrashSpawn")
|
||||
if (nextSpawn) then
|
||||
if (nextSpawn == -1) then
|
||||
text = " (x)"
|
||||
elseif (nextSpawn > 0) then
|
||||
local timeLeft = nextSpawn - CurTime()
|
||||
if (timeLeft <= 60) then
|
||||
text = " (<1m)"
|
||||
else
|
||||
text = " ("..math.Round(timeLeft / 60).."m)"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ix.util.DrawText("Trash Spawner"..text, x, y - math.max(10, 32 * factor), color,
|
||||
TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, nil, math.max(255 * factor, 80))
|
||||
end
|
||||
|
||||
ix.observer:RegisterESPType("ix_trashspawner", drawTrashESP, "trash")
|
||||
end
|
||||
end
|
||||
99
gamemodes/darkrp/plugins/willardtrash/sv_plugin.lua
Normal file
99
gamemodes/darkrp/plugins/willardtrash/sv_plugin.lua
Normal 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/
|
||||
--]]
|
||||
|
||||
local PLUGIN = PLUGIN
|
||||
|
||||
function PLUGIN:RegisterSaveEnts()
|
||||
ix.saveEnts:RegisterEntity("ix_trashspawner", true, true, true, {
|
||||
OnSave = function(entity, data) --OnSave
|
||||
return {pos = data.pos, angles = data.angles, motion = false}
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- Called when Helix has loaded all of the entities.
|
||||
function PLUGIN:InitPostEntity()
|
||||
if (!ix.config.Get("SaveEntsOldLoadingEnabled")) then return end
|
||||
|
||||
local trashSpawns = ix.data.Get("trashSpawns")
|
||||
if trashSpawns then
|
||||
for _, v in pairs(trashSpawns) do
|
||||
local entity = ents.Create("ix_trashspawner")
|
||||
entity:SetAngles(v.angles)
|
||||
entity:SetPos(v.position)
|
||||
entity:Spawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Called just after data should be saved.
|
||||
function PLUGIN:SaveData()
|
||||
local trashSpawns = {}
|
||||
|
||||
local entities = ents.GetAll()
|
||||
for i = 1, #entities do
|
||||
if (entities[i]:GetClass() != "ix_trashspawner") then continue end
|
||||
local v = entities[i]
|
||||
trashSpawns[#trashSpawns + 1] = {
|
||||
angles = v:GetAngles(),
|
||||
position = v:GetPos(),
|
||||
}
|
||||
end
|
||||
|
||||
ix.data.Set("trashSpawns", trashSpawns)
|
||||
end
|
||||
|
||||
function PLUGIN:CharacterLoaded(char)
|
||||
local timerName = "UpdateTrashWindowFor "..tostring(char:GetName())
|
||||
local timerWindow = 0
|
||||
if (istable(char) and IsValid(char:GetPlayer())) then
|
||||
timer.Create(timerName, 1, 0, function ()
|
||||
timerWindow = timerWindow + 1
|
||||
if (!istable(char) or !IsValid(char:GetPlayer())) then
|
||||
timer.Remove(timerName)
|
||||
return
|
||||
end
|
||||
|
||||
local cooldownTime = char:GetTrashCooldownTime()
|
||||
if (cooldownTime > 0) then
|
||||
-- char is already in cooldown
|
||||
char:SetTrashCooldownTime(cooldownTime - 1)
|
||||
char:SetTrashCooldownWindowAttempts(0)
|
||||
timerWindow = 0
|
||||
return
|
||||
end
|
||||
|
||||
local attempts = char:GetTrashCooldownWindowAttempts()
|
||||
local attemptsMax = ix.config.Get("Trash Cooldown Threshold")
|
||||
if (attempts >= attemptsMax) then
|
||||
local ply = char:GetPlayer()
|
||||
if (!IsValid(ply)) then
|
||||
-- shouldn't happen here but we should check anyways
|
||||
return
|
||||
end
|
||||
|
||||
local windowTime = ix.config.Get("Trash Cooldown Window")
|
||||
if (timerWindow < windowTime) then
|
||||
-- attempts > max and within the window means we're putting the char on cooldown
|
||||
local cooldown = ix.config.Get("Trash Cooldown Time")
|
||||
char:SetTrashCooldownTime(cooldown)
|
||||
|
||||
ply:NotifyLocalized("You have been put in cooldown for searching through trash.")
|
||||
char:SetTrashCooldownWindowAttempts(0)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
char:SetTrashCooldownWindowAttempts(0) -- reset back to zero because we're outside the window
|
||||
char:SetTrashCooldownTime(0) -- reset back to zero because char should not be in cooldown
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user