From 2d42f06d86639289f95d13b8266ba4549ca2a0a6 Mon Sep 17 00:00:00 2001 From: Mikko Tuumanen Date: Sun, 14 Jun 2020 19:21:30 +0300 Subject: [PATCH] Make cards more readable in inventory --- init.lua | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/init.lua b/init.lua index 1d89233..878e004 100644 --- a/init.lua +++ b/init.lua @@ -35,19 +35,34 @@ local cardprefix="deck:card_" local cardprefixlen=string.len(cardprefix) local carddescriptions = {} local texturepositions = { - {"50,50"}, -- a - {"50,15","50,65"}, -- 2 - {"50,2","50,42","50,84"}, -- 3 - {"30,12","30,62","70,12","70,62"}, -- 4 - {"30,2","80,2","60,40","35,75","85,75"}, -- 5 - {"30,2","30,42","30,84","70,2","70,42","70,84"}, -- 6 - {"40,2","40,42","40,84","80,2","80,42","80,84","5,62"}, -- 7 - {"40,2","40,42","40,84","80,2","80,42","80,84","2,84","2,42"}, -- 8 - {"48,2","48,42","48,84","88,2","88,42","88,84","10,84","10,42","10,2"}, -- 9 - {"48,2","48,42","48,84","88,2","88,42","88,84","10,84","10,42","20,12","60,52"}, -- 10 - {"33,1"}, -- J - {"33,1"}, -- Q - {"33,1"}, -- K + -- These are a bit crowded looking positions for 128x128 texture + -- {"50,50"}, -- a + -- {"50,15","50,65"}, -- 2 + -- {"50,2","50,42","50,84"}, -- 3 + -- {"30,12","30,62","70,12","70,62"}, -- 4 + -- {"30,2","80,2","60,40","35,75","85,75"}, -- 5 + -- {"30,2","30,42","30,84","70,2","70,42","70,84"}, -- 6 + -- {"40,2","40,42","40,84","80,2","80,42","80,84","5,62"}, -- 7 + -- {"40,2","40,42","40,84","80,2","80,42","80,84","2,84","2,42"}, -- 8 + -- {"48,2","48,42","48,84","88,2","88,42","88,84","10,84","10,42","10,2"}, -- 9 + -- {"48,2","48,42","48,84","88,2","88,42","88,84","10,84","10,42","20,12","60,52"}, -- 10 + -- {"33,1"}, -- J + -- {"33,1"}, -- Q + -- {"33,1"}, -- K + +{"32,28"}, -- a +{"32,28"}, -- 2 +{"32,28"}, -- 3 +{"32,28"}, -- 4 +{"32,28"}, -- 5 +{"32,28"}, -- 6 +{"32,28"}, -- 7 +{"32,28"}, -- 8 +{"32,28"}, -- 9 +{"32,28"}, -- 10 +{"32,28"}, -- J +{"32,28"}, -- Q +{"32,28"}, -- K } local function generate_descriptions() @@ -57,12 +72,12 @@ local function generate_descriptions() for r=1,13,1 do descriptions[i]=rank[r].." of "..suit[s].."s" card_shortname[i]=rank_short[r]..string.sub(suit[s],1,1) - textures[i]="deck_white.png^[combine:128x128" + textures[i]="deck_white.png^[resize:96x96^[combine:96x96" for p=1,table.getn(texturepositions[r]),1 do textures[i]=textures[i]..":"..texturepositions[r][p].."=deck_"..suit[s]..".png" end textures[i]=textures[i].. - ":0,0=deck_"..rank_short[r]..".png"..suitcolorize[suitcolorizeindex[s]] + ":3,28=deck_"..rank_short[r]..".png"..suitcolorize[suitcolorizeindex[s]] i=i+1 end end @@ -122,7 +137,7 @@ for i = 1,table.getn(textures),1 do groups = cardgroups, palette = "deck_palette.png", paramtype2 = "color", - drawtype = "color", + drawtype = "normal", param2 = 4, on_construct = function(pos) local meta=minetest.get_meta(pos)