Skip to content

Commit

Permalink
Fixed randomized palette
Browse files Browse the repository at this point in the history
TL;DR cringe

New MT version 5.8.0 provides updated luajit which is randomizing hash
order when hash is iterated in pairs().

> Due to improved VM security, LuaJIT 2.1 may even use a different order on
> separate VM invocations or when string keys are newly interned.
  • Loading branch information
ssdaniel24 authored and alek13 committed Jun 9, 2024
1 parent 97c621b commit 28d76ae
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions mods/_various/painting/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,30 @@
-- compositing engine (see tile.cpp).
local SL = lord.require_intllib()

local textures = {
white = "white.png",
yellow = "yellow.png",
orange = "orange.png",
red = "red.png",
violet = "violet.png",
blue = "blue.png",
green = "green.png",
magenta = "magenta.png",
cyan = "cyan.png",
grey = "grey.png",
darkgrey = "darkgrey.png",
black = "black.png",
darkgreen = "darkgreen.png",
brown = "brown.png",
pink = "pink.png"
local revcolors = {
[1] = "white",
[2] = "darkgreen",
[3] = "grey",
[4] = "red",
[5] = "brown",
[6] = "cyan",
[7] = "orange",
[8] = "violet",
[9] = "darkgrey",
[10] = "pink",
[11] = "green",
[12] = "magenta",
[13] = "yellow",
[14] = "black",
[15] = "blue",
}

local textures = {}
for _, col in ipairs(revcolors) do
textures[col] = col..".png"
end

local colors = {}
local revcolors = {}
local thickness = 0.1

-- picture node
Expand Down Expand Up @@ -514,8 +518,6 @@ local brush = {

for color, _ in pairs(textures) do

table.insert(revcolors, color)

local brush_new = table_copy(brush)

brush_new.description = SL(color:gsub("^%l", string.upper)) .. " " .. SL("brush")
Expand Down

0 comments on commit 28d76ae

Please sign in to comment.