File: code.lua

package info (click to toggle)
fillets-ng-data 1.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180,924 kB
  • sloc: makefile: 2
file content (94 lines) | stat: -rw-r--r-- 3,137 bytes parent folder | download | duplicates (8)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

local cubes = {}
for index = 0, 9 do
    cubes[index] = getModelsTable()[first_cube.index + index]
end

-- -----------------------------------------------------------------
-- Init
-- -----------------------------------------------------------------
local function prog_init()
    initModels()
    sound_playMusic("music/rybky07.ogg")
    local pokus = getRestartCount()


    -- -------------------------------------------------------------
    local function prog_init_room()
        local pom1, pom2, pomb1, pomb2 = 0, 0, false, false

        room.zacatek = 0
        room.pocitadlo = 300 + random(400 + pokus * 500)
        room.konec = 0

        return function()
            if no_dialog() and isReady(small) and isReady(big) then
                if room.pocitadlo > 1 then
                    room.pocitadlo = room.pocitadlo - 1
                end
                if room.zacatek == 0 then
                    addm(9 + random(35), "tet-m-vypadala")
                    if pokus < 5 or random(100) < 50 then
                        addv(5, "tet-v-ucta")
                        addm(9, "tet-m-usudek")
                    end
                    room.zacatek = 1
                elseif room.pocitadlo == 0 then
                    room.pocitadlo = -1
                    addv(9, "tet-v-myslim")
                    if random(100) < 50 then
                        addm(9, "tet-m-ano")
                    end
                    addv(9, "tet-v-lepsi")
                    if random(100) < 50 then
                        addm(16, "tet-m-jaklepsi")
                        addv(6, "tet-v-hybat")
                    end
                    if random(100) < 70 then
                        addm(16, "tet-m-predmety")
                    end
                    addv(16, "tet-v-uprava")
                    addm(6, "tet-m-program")
                    if random(100) < 50 then
                        addm(60, "tet-m-pozor")
                    end
                elseif room.konec == 0 and trubka.X == 29 and trubka.dir == dir_no then
                    room.konec = 1
                    pom2 = 100
                    for key, cube in pairs(cubes) do
                        if cube.Y < pom2 then
                            pom2 = cube.Y
                        end
                    end
                    if pom2 < 17 then
                        addv(9, "tet-v-kostky")
                        if random(100) > 10 * (pokus - 3) or random(100) < 50 then
                            addm(15 + random(7), "tet-m-lepe")
                        end
                    end
                end
            end
        end
    end

    -- --------------------
    local update_table = {}
    local subinit
    subinit = prog_init_room()
    if subinit then
        table.insert(update_table, subinit)
    end
    return update_table
end
local update_table = prog_init()


-- -----------------------------------------------------------------
-- Update
-- -----------------------------------------------------------------
function prog_update()
    for key, subupdate in pairs(update_table) do
        subupdate()
    end
end