2022-01-01 01:32:52 +00:00
|
|
|
local constants = require("constants")
|
2022-01-01 07:52:02 +00:00
|
|
|
local util = require("utils")
|
2022-01-02 17:40:30 +00:00
|
|
|
local rpc = require("rpc")
|
2022-01-08 20:42:25 +00:00
|
|
|
require("compat")
|
2022-01-01 01:32:52 +00:00
|
|
|
|
|
|
|
return function(commands)
|
2022-06-19 09:29:10 +00:00
|
|
|
function commands.moveUpdate(clientID, args)
|
|
|
|
if not clients[clientID] then rpc.print("moveUpdate: invalid clientid [" .. clientID .. "]") return end
|
2022-01-03 17:57:00 +00:00
|
|
|
local x, y, speedx, speedy = table.unpack(util.resolve(args))
|
2022-01-01 01:32:52 +00:00
|
|
|
clients[clientID].x = x
|
|
|
|
clients[clientID].y = y
|
|
|
|
clients[clientID].speedx = speedx
|
|
|
|
clients[clientID].speedy = speedy
|
|
|
|
|
2022-07-03 18:32:45 +00:00
|
|
|
broadcast(clientID, util.unit("moveUpdate", x, y, speedx, speedy))
|
2022-01-01 01:32:52 +00:00
|
|
|
end
|
2022-01-03 17:57:00 +00:00
|
|
|
|
2022-06-19 09:29:10 +00:00
|
|
|
|
|
|
|
function commands.moveFlying(clientID, args)
|
|
|
|
if not clients[clientID] then rpc.print("moveFlying: invalid clientid [" .. clientID .. "]") return end
|
2022-07-03 18:32:45 +00:00
|
|
|
broadcast(clientID, util.unit("moveFlying", args))
|
2022-01-09 09:18:36 +00:00
|
|
|
end
|
2022-06-19 09:29:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
function commands.deletePhysics(clientID, args)
|
|
|
|
if not clients[clientID] then rpc.print("deletePhysics: invalid clientid [" .. clientID .. "]") return end
|
2022-07-03 18:32:45 +00:00
|
|
|
broadcast(clientID, util.unit("deletePhysics", args))
|
2022-01-03 17:57:00 +00:00
|
|
|
end
|
|
|
|
|
2022-06-19 09:29:10 +00:00
|
|
|
function commands.drawPhysics(clientID, args)
|
|
|
|
if not clients[clientID] then rpc.print("drawPhysics: invalid clientid [" .. clientID .. "]") return end
|
2022-07-03 18:32:45 +00:00
|
|
|
broadcast(clientID, util.unit("drawPhysics", args))
|
2022-01-03 17:57:00 +00:00
|
|
|
end
|
2022-01-01 01:32:52 +00:00
|
|
|
end
|