Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.

Commit

Permalink
Remove the bullshit and fix the sprite once and for all
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbith committed Jul 1, 2022
1 parent 32779ab commit 6dd95a6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
1 change: 0 additions & 1 deletion init.lua
Expand Up @@ -28,7 +28,6 @@ i3 = {
max_waypoints = 30,
min_fs_version = 4,
item_btn_size = 1.1,
sprite_resolution = 256,
drop_bag_on_die = true,
save_interval = 600, -- Player data save interval (in seconds)

Expand Down
10 changes: 2 additions & 8 deletions src/caches.lua
Expand Up @@ -34,7 +34,7 @@ local function cache_groups(group, groups)
local items = i3.groups[group].items
if #items <= 1 then return end

local px, c, lim = i3.settings.sprite_resolution, 0, 10
local px, lim, c = 64, 10, 0
local sprite = "[combine:WxH"

for _, item in ipairs(items) do
Expand All @@ -44,16 +44,10 @@ local function cache_groups(group, groups)

if def.drawtype and is_cube(def.drawtype) then
texture = get_cube(tiles)
elseif texture then
-- Buggy, it disforms the texture but can handle any sequence
texture = texture:gsub("%^", "\\^"):gsub(":", "\\:") .. "\\^[resize\\:146x146"

--[[ Alternative, it scales a flat texture perfectly but does not
handle correctly mixed sequence like: inv cube -> flat texture -> inv cube ]]
-- px = 112
end

if texture then
texture = texture:gsub("%^", "\\^"):gsub(":", "\\:") .. fmt("\\^[resize\\:%ux%u", px, px)
sprite = sprite .. fmt(":0,%u=%s", c * px, texture)
c++
if c == lim then break end
Expand Down
2 changes: 1 addition & 1 deletion src/gui.lua
Expand Up @@ -1034,7 +1034,7 @@ local function get_grid_fs(fs, data, rcp, is_recipe)

if group_cache and group_cache.sprite and not large_recipe then
local sprite = ESC(group_cache.sprite)
local size = (i3.settings.sprite_resolution * 1.89) / 256
local size = btn_size - 0.02

item_image_button(X, Y, btn_size, btn_size, "", btn_name, "")
animated_image(X + 0.01, Y + 0.01, size, size, sprite, group_cache.count, 1500)
Expand Down

0 comments on commit 6dd95a6

Please sign in to comment.