mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-18 14:13:46 +03:00
98 lines
2.7 KiB
Lua
98 lines
2.7 KiB
Lua
|
|
--[[
|
|||
|
|
| 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 = "Military Container"
|
|||
|
|
ENT.Category = "[WN7] Lootable"
|
|||
|
|
ENT.Spawnable = true
|
|||
|
|
ENT.bNoPersist = true
|
|||
|
|
ENT.AutomaticFrameAdvance = true
|
|||
|
|
|
|||
|
|
ENT.models = {"models/wn7new/advcrates/n7_military_crate.mdl"}
|
|||
|
|
ENT.acting = 3
|
|||
|
|
ENT.canBeLooted = true
|
|||
|
|
ENT.lootKey = "militarykey"
|
|||
|
|
|
|||
|
|
local PLUGIN = PLUGIN
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (SERVER) then
|
|||
|
|
function ENT:Initialize()
|
|||
|
|
self:SetModel(self.models[math.random(1, #self.models)])
|
|||
|
|
self:PhysicsInit(SOLID_VPHYSICS )
|
|||
|
|
self:SetSolid(SOLID_VPHYSICS)
|
|||
|
|
self:SetUseType(SIMPLE_USE)
|
|||
|
|
self.lootTable = ix.loot.tables["Military"]
|
|||
|
|
local physObj = self:GetPhysicsObject()
|
|||
|
|
if (IsValid(physObj)) then
|
|||
|
|
physObj:Sleep()
|
|||
|
|
physObj:EnableMotion( false )
|
|||
|
|
end
|
|||
|
|
self:DropToFloor()
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
function ENT:Use( activator )
|
|||
|
|
if #player.GetAll() < ix.config.Get("PlayersToLoot", 8) then
|
|||
|
|
activator:Notify("Kutu lootlamak için sunucuda yeterli oyuncu yok.")
|
|||
|
|
return
|
|||
|
|
end
|
|||
|
|
if not self.canBeLooted then return activator:Notify("Birisi zaten bu konteyneri yağmaladı!") end
|
|||
|
|
local data = {act = self.acting, ent = self}
|
|||
|
|
netstream.Start(activator, "ixLootInteractStart", data)
|
|||
|
|
end
|
|||
|
|
function ENT:FinalizeLoot(character, shouldChance, noAddLoot)
|
|||
|
|
if not self.canBeLooted then return end
|
|||
|
|
|
|||
|
|
self:ResetSequence("locker_open_seq")
|
|||
|
|
self:SetPlaybackRate(1)
|
|||
|
|
self:EmitSound("buttons/button19.wav")
|
|||
|
|
timer.Simple(2.6, function()
|
|||
|
|
if not IsValid(self) then return end
|
|||
|
|
self:EmitSound("items/ammocrate_close.wav")
|
|||
|
|
self:ResetSequence("locker_close_seq")
|
|||
|
|
self:SetPlaybackRate(1)
|
|||
|
|
end)
|
|||
|
|
local items = PLUGIN:CalculateLoot(self.lootTable, shouldChance, noAddLoot)
|
|||
|
|
if #items <= 1 then
|
|||
|
|
self:EmitSound("physics/metal/metal_computer_impact_hard2.wav")
|
|||
|
|
end
|
|||
|
|
for _, item in ipairs(items) do
|
|||
|
|
ix.item.Spawn(item, self:GetPos() + self:GetUp()*20 + self:GetForward()*20 + self:GetRight()*math.random(-20, 20), function(item, ent)
|
|||
|
|
timer.Create("Mark for destruct " .. ent:GetCreationID(), ix.config.Get("lootDelete", 10), 1, function()
|
|||
|
|
if ent:IsValid() then
|
|||
|
|
ent:Remove()
|
|||
|
|
end
|
|||
|
|
end)
|
|||
|
|
end)
|
|||
|
|
end
|
|||
|
|
self.canBeLooted = false
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
function ENT:Think()
|
|||
|
|
self:NextThink( CurTime() + 0.1 )
|
|||
|
|
return true
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
function ENT:OnPopulateEntityInfo(container)
|
|||
|
|
local name = container:AddRow("name")
|
|||
|
|
name:SetImportant()
|
|||
|
|
name:SetText("Askeri Kutu")
|
|||
|
|
name:SizeToContents()
|
|||
|
|
|
|||
|
|
local description = container:AddRow("Description")
|
|||
|
|
description:SetText("Etkileşim için [E].")
|
|||
|
|
description:SizeToContents()
|
|||
|
|
end
|
|||
|
|
function ENT:Draw()
|
|||
|
|
self:DrawModel()
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|