Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gamemode/core/util/cl_draw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function nut.util.wrapText(text, width, font)
local maxW = 0

if (w <= width) then
return {(text:gsub("%s", " "))}, w
return {text:gsub("%s", " ")}, w
end

for i = 1, #exploded do
Expand Down
24 changes: 14 additions & 10 deletions gamemode/items/base/sh_outfit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ function ITEM:removeOutfit(client)
client:SetSkin(character:getData("oldSkin", character:getData("skin", 0)))
character:setData("oldSkin", nil)

for k, v in pairs(self.bodyGroups or {}) do

local oldGroups = character:getData("oldGroups", {})
for k in pairs(self.bodyGroups or {}) do
local index = client:FindBodygroupByName(k)

if (index > -1) then
client:SetBodygroup(index, 0)
client:SetBodygroup(index, oldGroups[index] or 0)

local groups = character:getData("groups", {})

Expand All @@ -74,6 +76,7 @@ function ITEM:removeOutfit(client)
end
end
end
character:setData("oldGroups", nil)
end

-- Then, remove PAC parts from this outfit.
Expand Down Expand Up @@ -134,7 +137,7 @@ ITEM.functions.Equip = {
local char = item.player:getChar()
local items = char:getInv():getItems()

for id, other in pairs(items) do
for _, other in pairs(items) do
if (
item ~= other and
item.outfitCategory == other.outfitCategory and
Expand Down Expand Up @@ -167,7 +170,7 @@ ITEM.functions.Equip = {
):lower()
char:setModel(newModel)
else
for k, v in ipairs(item.replacements) do
for _, v in ipairs(item.replacements) do
char:setModel(item.player:GetModel():gsub(v[1], v[2]))
end
end
Expand All @@ -185,18 +188,21 @@ ITEM.functions.Equip = {

-- Then set appropriate body groups for the model.
if (istable(item.bodyGroups)) then
local oldGroups = {}
local groups = {}

for k, value in pairs(item.bodyGroups) do
local index = item.player:FindBodygroupByName(k)

if (index > -1) then
oldGroups[index] = item.player:GetBodygroup(index)
groups[index] = value
end
end

local newGroups = char:getData("groups", {})
char:setData("oldGroups", oldGroups)

local newGroups = char:getData("groups", {})
for index, value in pairs(groups) do
newGroups[index] = value
item.player:SetBodygroup(index, value)
Expand Down Expand Up @@ -239,11 +245,9 @@ function ITEM:onLoadout()
end

function ITEM:onRemoved()
local inv = nut.item.inventories[self.invID]
if (IsValid(receiver) and receiver:IsPlayer()) then
if (self:getData("equip")) then
self:removeOutfit(receiver)
end
--local inv = nut.item.inventories[self.invID]
if (IsValid(receiver) and receiver:IsPlayer()) and (self:getData("equip")) then
self:removeOutfit(receiver)
end
end

Expand Down