add sborka
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
local PLUGIN = PLUGIN
|
||||
local meta = ix.meta.character
|
||||
|
||||
PLUGIN.name = "Inventory"
|
||||
PLUGIN.author = "MediQ"
|
||||
PLUGIN.description = "Adds simple stalker inventory"
|
||||
|
||||
ix.stalker = ix.stalker or {}
|
||||
ix.stalker.slots = ix.stalker.slots or {
|
||||
--["shlem"] = {2, 2},
|
||||
--["armor"] = {2, 2},
|
||||
--["sumka"] = {2, 2},
|
||||
--["flashlight"] = {2, 2},
|
||||
--["primary"] = {2, 6},
|
||||
--["primary2"] = {2, 6},
|
||||
--["pistol"] = {2, 2},
|
||||
--["melee"] = {2, 2}
|
||||
}
|
||||
|
||||
ix.config.Add("maxWeight", 30, "The maximum number of weight a player can take.", nil, { data = {min = 10, max = 100}, category = "characters" })
|
||||
|
||||
if (CLIENT) then
|
||||
-- Helper function for drawing partial textured rectangles
|
||||
function surface.DrawPartialTexturedRect(x, y, w, h, startX, startY, endX, endY, texW, texH)
|
||||
local u1 = startX / texW
|
||||
local v1 = startY / texH
|
||||
local u2 = (startX + endX) / texW
|
||||
local v2 = (startY + endY) / texH
|
||||
|
||||
surface.DrawTexturedRectUV(x, y, w, h, u1, v1, u2, v2)
|
||||
end
|
||||
end
|
||||
|
||||
function meta:GetInventorySlot(slot)
|
||||
if !self then return end
|
||||
slot = slot:lower()
|
||||
local character_inv = self.vars.inv
|
||||
|
||||
if character_inv then
|
||||
for slot_name, inv in pairs(character_inv) do
|
||||
if inv.vars and inv.vars.isBag == slot then
|
||||
return inv
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if (CLIENT) then
|
||||
local d = CurTime()
|
||||
|
||||
function PLUGIN:Think()
|
||||
local c = LocalPlayer():GetCharacter()
|
||||
local b = ix.gui.invframe
|
||||
if input.IsKeyDown(KEY_I) && d < CurTime() then
|
||||
|
||||
if !c then return end
|
||||
|
||||
if not IsValid(ix.gui.invframe) then
|
||||
local a = true
|
||||
if !LocalPlayer():IsRagdoll() && !vgui.CursorVisible() && !LocalPlayer():IsTyping() && !LocalPlayer():IsFrozen() && a then
|
||||
vgui.Create('NDInventory')
|
||||
end
|
||||
else
|
||||
ix.gui.invframe:OnRemove()
|
||||
end
|
||||
d = CurTime() + 0.5
|
||||
end
|
||||
|
||||
if b then
|
||||
if (LocalPlayer():IsFrozen() || LocalPlayer():IsTyping() || gui.IsGameUIVisible() || (IsValid(c) && LocalPlayer():IsRagdoll())) && b:IsVisible() then
|
||||
b:OnRemove()
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
ix.util.Include("sv_inventory.lua", "server")
|
||||
end
|
||||
|
||||
ix.models = {}
|
||||
ix.models.avatars = {}
|
||||
--ix.models.avatars[FACTION_NEUTRAL] = "vgui/icons/face_3.png"
|
||||
Reference in New Issue
Block a user