mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-17 13:53:45 +03:00
Upload
This commit is contained in:
182
gamemodes/helix/gamemode/items/base/sh_pacoutfit.lua
Normal file
182
gamemodes/helix/gamemode/items/base/sh_pacoutfit.lua
Normal file
@@ -0,0 +1,182 @@
|
||||
--[[
|
||||
| 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/
|
||||
--]]
|
||||
|
||||
|
||||
ITEM.name = "PAC Outfit"
|
||||
ITEM.description = "A PAC Outfit Base."
|
||||
ITEM.category = "Outfit"
|
||||
ITEM.model = "models/Gibs/HGIBS.mdl"
|
||||
ITEM.width = 1
|
||||
ITEM.height = 1
|
||||
ITEM.outfitCategory = "hat"
|
||||
ITEM.pacData = {}
|
||||
|
||||
--[[
|
||||
ITEM.pacData = {
|
||||
[1] = {
|
||||
["children"] = {
|
||||
[1] = {
|
||||
["children"] = {
|
||||
},
|
||||
["self"] = {
|
||||
["Angles"] = Angle(12.919322967529, 6.5696062847564e-006, -1.0949343050015e-005),
|
||||
["Position"] = Vector(-2.099609375, 0.019973754882813, 1.0180969238281),
|
||||
["UniqueID"] = "4249811628",
|
||||
["Size"] = 1.25,
|
||||
["Bone"] = "eyes",
|
||||
["Model"] = "models/Gibs/HGIBS.mdl",
|
||||
["ClassName"] = "model",
|
||||
},
|
||||
},
|
||||
},
|
||||
["self"] = {
|
||||
["ClassName"] = "group",
|
||||
["UniqueID"] = "907159817",
|
||||
["EditorExpand"] = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- This will change a player's skin after changing the model. Keep in mind it starts at 0.
|
||||
ITEM.newSkin = 1
|
||||
-- This will change a certain part of the model.
|
||||
ITEM.replacements = {"group01", "group02"}
|
||||
-- This will change the player's model completely.
|
||||
ITEM.replacements = "models/manhack.mdl"
|
||||
-- This will have multiple replacements.
|
||||
ITEM.replacements = {
|
||||
{"male", "female"},
|
||||
{"group01", "group02"}
|
||||
}
|
||||
|
||||
-- This will apply body groups.
|
||||
ITEM.bodyGroups = {
|
||||
["blade"] = 1,
|
||||
["bladeblur"] = 1
|
||||
}
|
||||
|
||||
--]]
|
||||
|
||||
-- Inventory drawing
|
||||
if (CLIENT) then
|
||||
-- Draw camo if it is available.
|
||||
function ITEM:PaintOver(item, w, h)
|
||||
if (item:GetData("equip")) then
|
||||
surface.SetDrawColor(110, 255, 110, 100)
|
||||
surface.DrawRect(w - 14, h - 14, 8, 8)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:RemovePart(client)
|
||||
local char = client:GetCharacter()
|
||||
|
||||
self:SetData("equip", false)
|
||||
client:RemovePart(self.uniqueID)
|
||||
|
||||
if (self.attribBoosts) then
|
||||
for k, _ in pairs(self.attribBoosts) do
|
||||
char:RemoveBoost(self.uniqueID, k)
|
||||
end
|
||||
end
|
||||
|
||||
self:OnUnequipped()
|
||||
end
|
||||
|
||||
-- On item is dropped, Remove a weapon from the player and keep the ammo in the item.
|
||||
ITEM:Hook("drop", function(item)
|
||||
if (item:GetData("equip")) then
|
||||
item:RemovePart(item:GetOwner())
|
||||
end
|
||||
end)
|
||||
|
||||
-- On player uneqipped the item, Removes a weapon from the player and keep the ammo in the item.
|
||||
ITEM.functions.EquipUn = { -- sorry, for name order.
|
||||
name = "Déséquiper",
|
||||
tip = "equipTip",
|
||||
icon = "icon16/cross.png",
|
||||
OnRun = function(item)
|
||||
item:RemovePart(item.player)
|
||||
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local client = item.player
|
||||
|
||||
return !IsValid(item.entity) and IsValid(client) and item:GetData("equip") == true and
|
||||
hook.Run("CanPlayerUnequipItem", client, item) != false
|
||||
end
|
||||
}
|
||||
|
||||
-- On player eqipped the item, Gives a weapon to player and load the ammo data from the item.
|
||||
ITEM.functions.Equip = {
|
||||
name = "Équiper",
|
||||
tip = "equipTip",
|
||||
icon = "icon16/tick.png",
|
||||
OnRun = function(item)
|
||||
local char = item.player:GetCharacter()
|
||||
local items = char:GetInventory():GetItems()
|
||||
|
||||
for _, v in pairs(items) do
|
||||
if (v.id != item.id) then
|
||||
local itemTable = ix.item.instances[v.id]
|
||||
|
||||
if (itemTable.pacData and v.outfitCategory == item.outfitCategory and itemTable:GetData("equip")) then
|
||||
item.player:NotifyLocalized(item.equippedNotify or "outfitAlreadyEquipped")
|
||||
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
item:SetData("equip", true)
|
||||
item.player:AddPart(item.uniqueID, item)
|
||||
|
||||
if (item.attribBoosts) then
|
||||
for k, v in pairs(item.attribBoosts) do
|
||||
char:AddBoost(item.uniqueID, k, v)
|
||||
end
|
||||
end
|
||||
|
||||
item:OnEquipped()
|
||||
return false
|
||||
end,
|
||||
OnCanRun = function(item)
|
||||
local client = item.player
|
||||
|
||||
return !IsValid(item.entity) and IsValid(client) and item:GetData("equip") != true and
|
||||
hook.Run("CanPlayerEquipItem", client, item) != false
|
||||
end
|
||||
}
|
||||
|
||||
function ITEM:CanTransfer(oldInventory, newInventory)
|
||||
if (newInventory and self:GetData("equip")) then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function ITEM:OnRemoved()
|
||||
local inventory = ix.item.inventories[self.invID]
|
||||
local owner = inventory.GetOwner and inventory:GetOwner()
|
||||
|
||||
if (IsValid(owner) and owner:IsPlayer()) then
|
||||
if (self:GetData("equip")) then
|
||||
self:RemovePart(owner)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ITEM:OnEquipped()
|
||||
end
|
||||
|
||||
function ITEM:OnUnequipped()
|
||||
end
|
||||
Reference in New Issue
Block a user