Make cards more readable in inventory

This commit is contained in:
Mikko Tuumanen 2020-06-14 19:21:30 +03:00
parent c9f237f838
commit 2d42f06d86

View File

@ -35,19 +35,34 @@ local cardprefix="deck:card_"
local cardprefixlen=string.len(cardprefix) local cardprefixlen=string.len(cardprefix)
local carddescriptions = {} local carddescriptions = {}
local texturepositions = { local texturepositions = {
{"50,50"}, -- a -- These are a bit crowded looking positions for 128x128 texture
{"50,15","50,65"}, -- 2 -- {"50,50"}, -- a
{"50,2","50,42","50,84"}, -- 3 -- {"50,15","50,65"}, -- 2
{"30,12","30,62","70,12","70,62"}, -- 4 -- {"50,2","50,42","50,84"}, -- 3
{"30,2","80,2","60,40","35,75","85,75"}, -- 5 -- {"30,12","30,62","70,12","70,62"}, -- 4
{"30,2","30,42","30,84","70,2","70,42","70,84"}, -- 6 -- {"30,2","80,2","60,40","35,75","85,75"}, -- 5
{"40,2","40,42","40,84","80,2","80,42","80,84","5,62"}, -- 7 -- {"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","2,84","2,42"}, -- 8 -- {"40,2","40,42","40,84","80,2","80,42","80,84","5,62"}, -- 7
{"48,2","48,42","48,84","88,2","88,42","88,84","10,84","10,42","10,2"}, -- 9 -- {"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","20,12","60,52"}, -- 10 -- {"48,2","48,42","48,84","88,2","88,42","88,84","10,84","10,42","10,2"}, -- 9
{"33,1"}, -- J -- {"48,2","48,42","48,84","88,2","88,42","88,84","10,84","10,42","20,12","60,52"}, -- 10
{"33,1"}, -- Q -- {"33,1"}, -- J
{"33,1"}, -- K -- {"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() local function generate_descriptions()
@ -57,12 +72,12 @@ local function generate_descriptions()
for r=1,13,1 do for r=1,13,1 do
descriptions[i]=rank[r].." of "..suit[s].."s" descriptions[i]=rank[r].." of "..suit[s].."s"
card_shortname[i]=rank_short[r]..string.sub(suit[s],1,1) 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 for p=1,table.getn(texturepositions[r]),1 do
textures[i]=textures[i]..":"..texturepositions[r][p].."=deck_"..suit[s]..".png" textures[i]=textures[i]..":"..texturepositions[r][p].."=deck_"..suit[s]..".png"
end end
textures[i]=textures[i].. 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 i=i+1
end end
end end
@ -122,7 +137,7 @@ for i = 1,table.getn(textures),1 do
groups = cardgroups, groups = cardgroups,
palette = "deck_palette.png", palette = "deck_palette.png",
paramtype2 = "color", paramtype2 = "color",
drawtype = "color", drawtype = "normal",
param2 = 4, param2 = 4,
on_construct = function(pos) on_construct = function(pos)
local meta=minetest.get_meta(pos) local meta=minetest.get_meta(pos)