35 lines
1.2 KiB
Lua
35 lines
1.2 KiB
Lua
local constants = require("constants")
|
|
local util = require("utils")
|
|
local rpc = require("rpc")
|
|
require("compat")
|
|
|
|
return function(commands)
|
|
function commands.moveUpdate(clientID, args)
|
|
if not clients[clientID] then rpc.print("moveUpdate: invalid clientid [" .. clientID .. "]") return end
|
|
local x, y, speedx, speedy = table.unpack(util.resolve(args))
|
|
clients[clientID].x = x
|
|
clients[clientID].y = y
|
|
clients[clientID].speedx = speedx
|
|
clients[clientID].speedy = speedy
|
|
|
|
broadcast(clientID, util.unit("moveUpdate", x, y, speedx, speedy))
|
|
end
|
|
|
|
|
|
function commands.moveFlying(clientID, args)
|
|
if not clients[clientID] then rpc.print("moveFlying: invalid clientid [" .. clientID .. "]") return end
|
|
broadcast(clientID, util.unit("moveFlying", args))
|
|
end
|
|
|
|
|
|
function commands.deletePhysics(clientID, args)
|
|
if not clients[clientID] then rpc.print("deletePhysics: invalid clientid [" .. clientID .. "]") return end
|
|
broadcast(clientID, util.unit("deletePhysics", args))
|
|
end
|
|
|
|
function commands.drawPhysics(clientID, args)
|
|
if not clients[clientID] then rpc.print("drawPhysics: invalid clientid [" .. clientID .. "]") return end
|
|
broadcast(clientID, util.unit("drawPhysics", args))
|
|
end
|
|
end
|