Compare commits
2 Commits
0c7c1705ad
...
7402d41896
Author | SHA1 | Date |
---|---|---|
Pascal Abresch | 7402d41896 | |
Pascal Abresch | 6a6723ea68 |
|
@ -15,7 +15,7 @@ mouse.lastpos.x = 0
|
|||
mouse.lastpos.y = 0
|
||||
|
||||
function alignToGrid(num, thing)
|
||||
return math.floor(num / thing) * thing
|
||||
return num - (num % thing)
|
||||
end
|
||||
|
||||
|
||||
|
|
41
lua/init.lua
41
lua/init.lua
|
@ -63,7 +63,6 @@ local socket = require "socket"
|
|||
local address = "127.0.0.1"
|
||||
local port = 11150
|
||||
local myname = "John Sheridan"
|
||||
|
||||
local client = socket.udp()
|
||||
client:setpeername(address, port)
|
||||
client:settimeout(0)
|
||||
|
@ -79,14 +78,14 @@ end
|
|||
|
||||
|
||||
function networkSend(args)
|
||||
if clientID == "0" then return end
|
||||
assert(clientID ~= "0")
|
||||
local request = "poppyV001" ..US.. myClientID ..US.. args
|
||||
client:send(request)
|
||||
end
|
||||
|
||||
|
||||
function networkSendLog(args)
|
||||
if clientID == "0" then print("FUCKFACE") return end
|
||||
assert(clientID ~= "0")
|
||||
local request = "poppyV001" ..US.. myClientID ..US.. args
|
||||
print("=>", request)
|
||||
client:send(request)
|
||||
|
@ -119,6 +118,39 @@ function love.keypressed(key, _)
|
|||
end
|
||||
|
||||
|
||||
function love.errorhandler(msg)
|
||||
networkSendLog(unit("player", "leave"))
|
||||
love.graphics.reset()
|
||||
love.graphics.origin()
|
||||
love.graphics.clear(.4, 0, 0)
|
||||
love.graphics.setColor(1, 1, 1)
|
||||
local message = love.graphics.newText(ui.bigFont, "Poppy has encountered a critical fault")
|
||||
local message2 = love.graphics.newText(ui.bigFont, "Press q to exit")
|
||||
love.graphics.draw(message, 40, 40, 0, 1, 1)
|
||||
love.graphics.draw(message2, 40, 95, 0, 1, 1)
|
||||
local indent = 0
|
||||
local messageline
|
||||
for line in msg:gmatch("([^\n]*)\n?") do
|
||||
messageline = love.graphics.newText(ui.bigFont, line)
|
||||
love.graphics.draw(messageline, 40, 205 + indent, 0, 1, 1)
|
||||
indent = indent + 55
|
||||
end
|
||||
love.graphics.present()
|
||||
return function()
|
||||
love.event.pump()
|
||||
for event, action in love.event.poll() do
|
||||
if event == "quit" then return 1 end
|
||||
if event == "keypressed" then
|
||||
if action == "q" then
|
||||
love.event.quit( 1 )
|
||||
end
|
||||
end
|
||||
end
|
||||
love.timer.sleep(0.1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function networkSync()
|
||||
local message, errorString = nil, false
|
||||
while not errorString do
|
||||
|
@ -158,9 +190,6 @@ function love.visible(visible)
|
|||
end
|
||||
end
|
||||
|
||||
function alignToGrid(num, thing)
|
||||
return math.floor(num / thing) * thing
|
||||
end
|
||||
|
||||
function normalDraw()
|
||||
local layerTransform = love.math.newTransform(math.floor(view.x) * scale, math.floor(view.y) * scale, 0, scale, scale)
|
||||
|
|
Loading…
Reference in New Issue