Skip to content

Commit

Permalink
add new tile and wall colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Berserker66 committed Jul 30, 2015
1 parent 35ab907 commit 816b681
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 83 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Current version : 17.5.0, for Terraria 1.3.0.7.
Current version : 17.5.1, for Terraria 1.3.0.7.

On the Terraria Forums:
[Link](http://forums.terraria.org/index.php?threads/omnitool-world-creation-mapping-backups-and-more.14664/)
Expand Down
19 changes: 12 additions & 7 deletions colorextract.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import os
import pygame
folder = "tImages"

colors = {}
for p in os.listdir(os.getcwd()):
for p in os.listdir(folder):
if p[-3:] == "png":
if p[:5] == "Tiles":
colorsum = [0, 0, 0]
image = pygame.image.load(p)
image = pygame.image.load(os.path.join(folder, p))
size = image.get_size()
i = 0
for x in range(size[0]):
Expand All @@ -20,9 +21,13 @@
else:
colorsum = [colorsum[0] + c[0], colorsum[1] + c[1], colorsum[2] + c[2]]
i += 1
color = (int(colorsum[0] / float(i)),
int(colorsum[1] / float(i)),
int(colorsum[2] / float(i)))
try:
color = (int(colorsum[0] / float(i)),
int(colorsum[1] / float(i)),
int(colorsum[2] / float(i)))
except ZeroDivisionError:
print(p, "is empty!")
color = (0,0,0)
try:
colors[int(p[6:].strip(".png"))] = color
except ValueError:
Expand All @@ -35,12 +40,12 @@

print("-"*70)
colors = {0: (0, 0, 0)}
for p in os.listdir(os.getcwd()):
for p in os.listdir(folder):
if p[-3:] == "png":
if p[:4] == "Wall" and p != "WallOfFlesh.png" and p != "Wall_Outline.png":

colorsum = [0, 0, 0]
image = pygame.image.load(p)
image = pygame.image.load(os.path.join(folder, p))
size = image.get_size()
i = 0
for x in range(size[0]):
Expand Down
Loading

0 comments on commit 816b681

Please sign in to comment.