Feature Complete Shipping V1.0

This commit is contained in:
2026-08-12 22:57:52 -04:00
parent 19e4ac0cce
commit 56b6a46811
30 changed files with 9934 additions and 9361 deletions
@@ -0,0 +1,75 @@
PaintMyKI5 = PaintMyKI5 or {}
PaintMyKI5.SandpaperDistribution = PaintMyKI5.SandpaperDistribution or {}
local SandpaperDistribution = PaintMyKI5.SandpaperDistribution
local SANDPAPER_ITEM = "PaintMyKI5.Sandpaper"
local SANDPAPER_WEIGHT = 0.1
local FULL_PAINT_CANS = {
PaintBlack = true,
PaintBlue = true,
PaintBrown = true,
PaintCyan = true,
PaintGreen = true,
PaintGrey = true,
PaintLightBlue = true,
PaintLightBrown = true,
PaintOrange = true,
PaintPink = true,
PaintPurple = true,
PaintRed = true,
PaintTurquoise = true,
PaintWhite = true,
PaintYellow = true,
}
local function isFullPaintCan(itemType)
if type(itemType) ~= "string" then return false end
if FULL_PAINT_CANS[itemType] then return true end
local moduleName, shortType = string.match(itemType, "^([^.]+)%.([^.]+)$")
return moduleName == "Base" and FULL_PAINT_CANS[shortType] == true
end
local function inspectItems(items)
local hasPaint = false
local hasSandpaper = false
if type(items) ~= "table" then return hasPaint, hasSandpaper end
for index = 1, #items, 2 do
local itemType = items[index]
if itemType == SANDPAPER_ITEM then
hasSandpaper = true
elseif isFullPaintCan(itemType) then
hasPaint = true
end
end
return hasPaint, hasSandpaper
end
local function injectIntoItems(items)
local hasPaint, hasSandpaper = inspectItems(items)
if not hasPaint or hasSandpaper then return 0 end
table.insert(items, SANDPAPER_ITEM)
table.insert(items, SANDPAPER_WEIGHT)
return 1
end
function SandpaperDistribution.inject(distributions, clutterTables)
local list = distributions and distributions.list
local added = 0
if type(list) == "table" then
for _, distribution in pairs(list) do
if type(distribution) == "table" then
added = added + injectIntoItems(distribution.items)
if type(distribution.junk) == "table" then
added = added + injectIntoItems(distribution.junk.items)
end
end
end
end
if type(clutterTables) == "table" then
added = added + injectIntoItems(clutterTables.ClosetItems)
end
return added
end
SandpaperDistribution.inject(ProceduralDistributions, ClutterTables)