Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def addhoedirt(x, y):
return sprite(
name='HoeDirt',
x=x,
y=y,
w=1, h=1,
index=None,
type=None,
growth=None,
flipped=None,
orientation=None
)
elif obj in buildings3:
objects.append(
sprite('Building', x, y, 4, 3, None, obj.replace('-', ' '), None, None, None)
)
elif obj in buildings4:
objects.append(
sprite('Building', x, y, 4, 4, None, obj.replace('-', ' '), None, None, None)
)
elif obj in buildings7:
objects.append(
sprite('Building', x, y - 1, 4, 7, None, obj.replace('-', ' '), None, None,
None)
)
elif obj in multiplayer_cabins:
objects.append(
sprite('Building', x, y, 5, 3, None, obj.replace('-', ' '), None, None, 0)
)
elif obj in craftable_index:
objects.append(
sprite('Object', x, y, 1, 1, craftable_index[obj], 'Crafting', 0, 0, 0)
)
elif obj == 'gate':
objects.append(
sprite('Fence', x, y, 0, 0, 0, 0, True, 0, obj)
)
elif obj == 'large-rock':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 672, None, None, None)
)
elif obj == 'large-log':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 602, None, None, None)
greenhouse = sprite('Greenhouse',
25, 12, 0, 6, 0,
None, None, None, None)
try:
g = False
if data['options']['greenhouse']:
g = True
except:
g = True
if g:
greenhouse = sprite('Greenhouse',
25, 12, 0, 6, 1,
None, None, None, None)
house = sprite('House',
58, 14, 10, 6, 0,
None, None, None, None)
farm['misc'] = [house, greenhouse]
try:
farm['HoeDirt'] = checkSurrounding(farm['HoeDirt'])
except Exception as e:
pass
try:
farm['Fence'] = checkSurrounding(farm['Fence'])
except Exception as e:
pass
try:
farm['Flooring'] = checkSurrounding(farm['Flooring'])
except Exception as e:
)
elif obj in multiplayer_cabins:
objects.append(
sprite('Building', x, y, 5, 3, None, obj.replace('-', ' '), None, None, 0)
)
elif obj in craftable_index:
objects.append(
sprite('Object', x, y, 1, 1, craftable_index[obj], 'Crafting', 0, 0, 0)
)
elif obj == 'gate':
objects.append(
sprite('Fence', x, y, 0, 0, 0, 0, True, 0, obj)
)
elif obj == 'large-rock':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 672, None, None, None)
)
elif obj == 'large-log':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 602, None, None, None)
)
elif obj == 'large-stump':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 600, None, None, None)
)
elif obj in crops:
if type(crops[obj]) is tuple:
t, s = crops[obj]
else:
t, s = crops[obj], 5
o = None
T = 0
elif 'crystal' in obj:
T = 3
elif 'weathered' in obj:
T = 2
elif 'stone' in obj:
T = 1
objects.append(
sprite('Flooring', x, y, 1, 1, None, T, 0, False, None)
)
else:
print('json input: obj not in known types: {} coords {}, {}'.format(obj, x, y))
farm = {k.name: [a for a in objects if a.name == k.name] for k in objects}
greenhouse = sprite('Greenhouse',
25, 12, 0, 6, 0,
None, None, None, None)
try:
g = False
if data['options']['greenhouse']:
g = True
except:
g = True
if g:
greenhouse = sprite('Greenhouse',
25, 12, 0, 6, 1,
None, None, None, None)
house = sprite('House',
58, 14, 10, 6, 0,
# Deal with different sized building footprints
buildings2 = ['stable', 'gold-clock', 'junimo-hut', 'mill']
buildings3 = ['silo', 'well', 'coop', 'water-obelisk', 'earth-obelisk', 'shed']
multiplayer_cabins = ['log-cabin', 'stone-cabin', 'plank-cabin']
buildings4 = ['barn']
buildings7 = ['slime-hutch']
for tile in tiles:
obj = tile['type']
x = int(int(tile['x']) / 16)
y = int(int(tile['y']) / 16)
if obj == 'grass':
objects.append(
sprite('Grass', x, y, 1, 1, 20, 1, random.randint(2, 4), random.randint(0, 1),
None)
)
if obj == 'weeds':
objects.append(
sprite('Object', x, y, 1, 1, 313 + random.randint(0, 2), 'Crafting', 0, None,
'Weeds')
)
elif obj == 'farmland':
objects.append(
addhoedirt(x, y)
)
objects.append(
sprite('HoeDirtCrop', x, y, 1, 1, 0, 0, random.randint(4, 5),
random.randint(0, 1), None)
)
elif obj == 'trellis':
)
elif obj in craftable_index:
objects.append(
sprite('Object', x, y, 1, 1, craftable_index[obj], 'Crafting', 0, 0, 0)
)
elif obj == 'gate':
objects.append(
sprite('Fence', x, y, 0, 0, 0, 0, True, 0, obj)
)
elif obj == 'large-rock':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 672, None, None, None)
)
elif obj == 'large-log':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 602, None, None, None)
)
elif obj == 'large-stump':
objects.append(
sprite('ResourceClump', x, y, 0, 0, None, 600, None, None, None)
)
elif obj in crops:
if type(crops[obj]) is tuple:
t, s = crops[obj]
else:
t, s = crops[obj], 5
o = None
if t in [26, 27, 28, 29, 31]:
o = (
plant_colours[obj][random.randint(0, len(plant_colours[obj]) - 1)],
5
print('json input: obj not in known types: {} coords {}, {}'.format(obj, x, y))
farm = {k.name: [a for a in objects if a.name == k.name] for k in objects}
greenhouse = sprite('Greenhouse',
25, 12, 0, 6, 0,
None, None, None, None)
try:
g = False
if data['options']['greenhouse']:
g = True
except:
g = True
if g:
greenhouse = sprite('Greenhouse',
25, 12, 0, 6, 1,
None, None, None, None)
house = sprite('House',
58, 14, 10, 6, 0,
None, None, None, None)
farm['misc'] = [house, greenhouse]
try:
farm['HoeDirt'] = checkSurrounding(farm['HoeDirt'])
except Exception as e:
pass
try:
farm['Fence'] = checkSurrounding(farm['Fence'])
except Exception as e:
elif 'oak-tree' in obj:
T = 1
elif 'pine-tree' in obj:
T = 3
elif 'mushroom' in obj:
T = 7
if obj in ['tree', 'maple-tree', 'oak-tree', 'pine-tree', 'mushroom']:
name = 'Tree'
if obj != 'tree':
x += 1
y += 2
objects.append(
sprite(name, x, y, 1, 1, 0, T, 5, random.randint(0, 1), 0)
)
elif obj in path_types:
if 'gravel' in obj:
T = 5
elif 'wood' in obj:
T = 6
elif 'crystal' in obj:
T = 7
elif 'road' in obj:
T = 8
elif 'steppingstone' in obj:
T = 9
objects.append(
sprite('Flooring', x, y, 1, 1, None, T, 0, False, None)
)
elif obj in floor_types: