Permalink
Browse files

render chests with tint

  • Loading branch information...
1 parent 1986739 commit 9f470a31aee608f5d54b51b3c1fa559991b2892a @Sketchy502 committed Oct 3, 2016
Showing with 23 additions and 2 deletions.
  1. +2 −1 .gitignore
  2. +13 −1 sdv/farmInfo.py
  3. +8 −0 sdv/imagegeneration/farm.py
View
@@ -82,4 +82,5 @@ sdv/templates/analytics.html
/.idea
logfile
assets/
-render_farm.py
+render_test.py
+test
View
@@ -70,6 +70,18 @@ def getFarmInfo(saveFile):
i = int(obj.find('parentSheetIndex').text)
t = obj.find('type').text
a = False
+ other = obj.find('name').text
+ if name == 'Chest':
+ colours = obj.find('playerChoiceColor')
+ try:
+ red = int(colours.find('R').text)
+ green = int(colours.find('G').text)
+ blue = int(colours.find('B').text)
+ tint = (red, green, blue)
+ other = [other, tint]
+ except Exception as e:
+ print('Error getting chest colours.' + e)
+
if obj.find('flipped').text == 'true':
f = True
if 'Fence' in name or name == 'Gate':
@@ -80,7 +92,7 @@ def getFarmInfo(saveFile):
name = 'Fence'
else:
name = 'Object'
- s.append(sprite(name, x, y, 0, 0, i, t, a, f, obj.find('name').text))
+ s.append(sprite(name, x, y, 0, 0, i, t, a, f, other))
d = {k[0]: [a for a in s if a[0] == k[0]] for k in s}
@@ -119,6 +119,14 @@ def generateFarm(season, data, assets=None):
else:
obj_img = cropImg(assets['objects'], item.index)
offset = 0
+ if len(item.orientation[1]) == 3:
+ # Seriously need to get reworking how images are rendered
+ obj_img = cropImg(assets['craftables'], 168,
+ (16, 32), (16, 32))
+ obj_img = tintImage(obj_img, item.orientation[1])
+ overlay = cropImg(assets['craftables'], 176,
+ (16, 32), (16, 32))
+ obj_img.paste(overlay, box=(0,0), mask=overlay)
farm_base.paste(obj_img, (item.x*16, item.y*16 - offset), obj_img)
if item.name == 'Fence':

0 comments on commit 9f470a3

Please sign in to comment.