1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
TS_tree = {}
val = 1
directory = 'gfx/TreeSetup/'
function TS_addtree(nr, x, y, s1, s2, rc, gc, bc, random, rc2, gc2, bc2)
	if rc and gc and bc then
		if random then
			if rc2 and gc2 and bc2 then
				b1 = math.random(rc, rc2)
				b2 = math.random(gc, gc2)
				b3 = math.random(bc, bc2)
			else
				print('TreeSetup.lua -> ERROR - rc2, gc2 and bc2 are not declared for tree '..nr)
			end
		else
			b1 = rc
			b2 = gc
			b3 = bc
		end
	else
		b = math.random(180, 255)
		b1 = b
		b2 = b
		b3 = b
	end
	if s1 and s2 then
		if s1 == 1 then
			print('TreeSetup.lua -> ERROR - You clearly didn\'t read the FUCKING DESCRIPTION! s1 and s2 at normal size is 100! Not 1!')
		end
		c = math.random(s1, s2) / 100
	else
		c = math.random(100, 140) / 100
	end
	TS_tree[val] = image(directory..'Tree'..nr..'.png', x, y, 1)
	imagepos(TS_tree[val], x * 32 + 16, y * 32 + 16, math.random(0, 360))
	imagecolor(TS_tree[val], b1, b2, b3)
	imagescale(TS_tree[val], c, c)
	val = val + 1
end
addhook("startround","TS_round")
function TS_round()
-- Small trees (first layer)
for y = 0, map('ysize') do
	for x = 0, map('xsize') do
		local a = entity(x, y, 'name')
		if a == 'tree1' then
			TS_addtree(1, x, y)
		elseif a == 'tree2' then
			TS_addtree(1, x, y, 100, 150, 200, 200, 200, true, 200, 255, 200)
		elseif a == 'tree4' then
			TS_addtree(3, x, y)
		end
	end
end
-- Big trees (second layer)
for y = 0, map('ysize') do
	for x = 0, map('xsize') do
		local a = entity(x, y, 'name')
		if a == 'tree3' then
			TS_addtree(1, x, y, 200, 220, 255, 255, 255)
		elseif a == 'tree5' then
			TS_addtree(3, x, y, 200, 220, 255, 255, 255)
		end
	end
end
end
parse("restartround")