aboutsummaryrefslogtreecommitdiff
path: root/main.lua
blob: 542b23c3d0909fa790a46ac9cfed60e6f160813a (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
function love.load()
  require "assets"
  require "window"
  require "panel"
  require "var"
  require "desktop"
  require "internet"
  require "files"
  require "antivirus"
  require "help"
  require "chat"
  require "settings"
  require "system"
  require "loading"
  require "elements"
  require "virus1"
  require "dialogue"
  require "viewer"
  require "virus2"
  loadPre()
end
function love.update(dt)
  delta = dt
  time = time + dt
  fps = love.timer.getFPS()
  sys.s = 60/fps
  sys.w = love.graphics.getWidth()
  sys.h = love.graphics.getHeight()
  sys.sw = sys.w/1920
  sys.sh = sys.h/1080
  minim = sys.h+10
  sys.mouse.x = love.mouse.getX()
  sys.mouse.y = love.mouse.getY()
  if love.keyboard.isDown("escape") == true and pause.esc == false and loaded == true and pause.p == false then
    love.audio.pause()
    pause.esc = true
    pause.p = true
    sys.mouse.p.p = false
  end
  if fade == 1 and fadeOpacity < 255 and pause.p == false then
    fadeOpacity = fadeOpacity + 5
    if scene == 0 and love.keyboard.isDown("1") == true then
      v1.complete = true
    elseif scene == 0 and love.keyboard.isDown("2") == true then
      v1.complete = true
      v2.complete = true
    end
  elseif fade == 0  and fadeOpacity > 0 and pause.p == false then
    fadeOpacity = fadeOpacity - 5
  end
  if scene == 1 and pause.p == false then
    updateSystem(dt)
  end
  if loaded == true and pause.p == false then
    if v1.yes == true and v1.complete == false then
      v1.timer = v1.timer + dt
    end
    if v1.yes == true and v1.timer >= 5 then
      scene = 2
      if v1.explodeintrotimer <= 7.8 then
        v1.explodeintrotimer = v1.explodeintrotimer + dt
      end
    end
  end
end
function love.mousepressed(x, y, button)
  if scene ~= 0 then
    sys.mouse.p.x = x
    sys.mouse.p.y = y
    if button ~= 1 then
      sys.mouse.p.p = false
    end
    if button == 1 then
      sys.mouse.p.p = true
    end
    if v1.msgs[v1.c.chat.msgs] ~= nil then
      if string.len(v1.msgs[v1.c.chat.msgs]) == string.len(v1.c.chat.msg) and v1.yes == true then
        v1.c.chat.next = false
      end
    end
    if v2.msgs[v2.c.chat.msgs] ~= nil then
      if string.len(v2.msgs[v2.c.chat.msgs]) == string.len(v2.c.chat.msg) and v2.start == true then
        v2.c.chat.next = false
      end
    end
  end
end
function love.keyreleased(key)
   if key == "f11" then
     if scene == 2 then
      v1.c.chat.msgs = v1.c.chat.msgs + 1
    elseif scene == 3 then
      v2.c.chat.msgs = v2.c.chat.msgs + 1
    end
   end
   if key == "f10" then
     if scene == 2 then
       v1.c.health = v1.c.health - 5
       v1.spm = v1.spm + 0.5*(sys.h/1080)
     elseif scene == 3 then
       v2.c.health = v2.c.health - 5
       v2.spm = v2.spm + 0.20*(sys.h/1080)
     end
   end
   if key == "escape" then
     pause.esc = false
   end
end
function love.keypressed(key)
  if key == "backspace" and layer[1] == 2 and v1.yes == false then
    internet.url = string.sub(internet.url, 1, string.len(internet.url)-1)
    if internet.url ~= internet.urlold then
      win[2].update = true
      internet.blink = true
      internet.blinkTimer = 0
    end
  end
  if key == "return" or key == "kpenter" then
    if layer[1] == 2 then
      internet.urlc = internet.url
      win[2].update = true
      internet.load = 0
    elseif layer[1] == 1 and chat.msg ~= "" then
      sendMessage(2, chat.msg)
      if chat.status == 1 then
        chatReply(string.lower(chat.msg))
      end
      chat.msg = ""
    end
  end
  if key == "backspace" and layer[1] == 1 and v1.yes == false then
    chat.msg = string.sub(chat.msg, 1, string.len(chat.msg)-1)
    if chat.msg ~= chat.msgold then
      win[1].update = true
      chat.blink = true
      chat.blinkTimer = 0.5
    end
  end
  if key == "z" then
    if v1.msgs[v1.c.chat.msgs] ~= nil then
      if string.len(v1.msgs[v1.c.chat.msgs]) == string.len(v1.c.chat.msg) and v1.yes == true then
        v1.c.chat.next = false
      end
    end
    if v2.msgs[v2.c.chat.msgs] ~= nil then
      if string.len(v2.msgs[v2.c.chat.msgs]) == string.len(v2.c.chat.msg) and v2.start == true then
        v2.c.chat.next = false
      end
    end
  end
end
function love.mousereleased(x, y, button)
  if scene ~= 0 then
    sys.mouse.p.p = false
    start.p = false
    for i=1,6 do
      icon[i].cl = false
    end
    file.p = false
    mplay.drag = false
    vplay.drag = false
    mplay.pr = false
    vplay.pr = false
    if layer[1] == 1 then
      win[1].update = true
    end
  end
end
function love.draw()
  if pause.p == true then
    drawPause()
  elseif scene == 1 then
    drawSystem()
  elseif scene == 0 then
    drawLoading()
  elseif scene == 2 then
    drawVirusFight1()
  elseif scene == 3 then
    drawVirusFight2()
  elseif scene == 666 then
    drawBSOD()
  end
end