replaced all remaining instances of sockfd with neth, fixes blocks not returning when spaded
This commit is contained in:
parent
c824f356a5
commit
7183e461e0
@ -389,9 +389,9 @@ function h_tick_main(sec_current, sec_delta)
|
|||||||
chat_prune(chat_text, sec_current)
|
chat_prune(chat_text, sec_current)
|
||||||
chat_prune(chat_killfeed, sec_current)
|
chat_prune(chat_killfeed, sec_current)
|
||||||
|
|
||||||
local pkt, sockfd
|
local pkt, neth
|
||||||
while true do
|
while true do
|
||||||
pkt, sockfd = common.net_recv()
|
pkt, neth = common.net_recv()
|
||||||
if not pkt then break end
|
if not pkt then break end
|
||||||
|
|
||||||
local cid
|
local cid
|
||||||
@ -400,7 +400,7 @@ function h_tick_main(sec_current, sec_delta)
|
|||||||
|
|
||||||
local hdl = network.sys_tab_handlers[cid]
|
local hdl = network.sys_tab_handlers[cid]
|
||||||
if hdl then
|
if hdl then
|
||||||
hdl.f(sockfd, cli, plr, sec_current, common.net_unpack(hdl.s, pkt))
|
hdl.f(neth, cli, plr, sec_current, common.net_unpack(hdl.s, pkt))
|
||||||
else
|
else
|
||||||
print(string.format("C: unhandled packet %02X", cid))
|
print(string.format("C: unhandled packet %02X", cid))
|
||||||
end
|
end
|
||||||
|
@ -35,11 +35,11 @@ function command_register(settings)
|
|||||||
func = settings.func
|
func = settings.func
|
||||||
} this.this = this
|
} this.this = this
|
||||||
|
|
||||||
function this.exec(player, plrid, sockfd, params, msg)
|
function this.exec(player, plrid, neth, params, msg)
|
||||||
if this.permission == nil or player.has_permission(this.permission) then
|
if this.permission == nil or player.has_permission(this.permission) then
|
||||||
this.func(player, plrid, sockfd, params, msg)
|
this.func(player, plrid, neth, params, msg)
|
||||||
else
|
else
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: You do not have permission for this command"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: You do not have permission for this command"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -51,13 +51,13 @@ function command_register_alias(command, alias)
|
|||||||
commands[alias] = commands[command]
|
commands[alias] = commands[command]
|
||||||
end
|
end
|
||||||
|
|
||||||
function command_handle(player, plrid, sockfd, params, msg)
|
function command_handle(player, plrid, neth, params, msg)
|
||||||
cmd = string.lower(params[1])
|
cmd = string.lower(params[1])
|
||||||
if commands[cmd] ~= nil then
|
if commands[cmd] ~= nil then
|
||||||
table.remove(params, 1)
|
table.remove(params, 1)
|
||||||
commands[cmd].exec(player, plrid, sockfd, params, msg)
|
commands[cmd].exec(player, plrid, neth, params, msg)
|
||||||
else
|
else
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: No such command"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: No such command"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -65,19 +65,19 @@ command_register({
|
|||||||
command = "help",
|
command = "help",
|
||||||
permission = nil,
|
permission = nil,
|
||||||
usage = "/help [command name]",
|
usage = "/help [command name]",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 0 then
|
if table.getn(prms) == 0 then
|
||||||
--TODO: List available commands
|
--TODO: List available commands
|
||||||
elseif table.getn(prms) == 1 then
|
elseif table.getn(prms) == 1 then
|
||||||
if commands[prms[1]] == nil then
|
if commands[prms[1]] == nil then
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: No such command"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: No such command"))
|
||||||
elseif plr.has_permission(commands[prms[1]].permission) then
|
elseif plr.has_permission(commands[prms[1]].permission) then
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_usage, "Usage: "..commands[prms[1]].usage))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_usage, "Usage: "..commands[prms[1]].usage))
|
||||||
else
|
else
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: You do not have permission for this command"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: You do not have permission for this command"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
this.func(plr, plrid, sockfd, "help")
|
this.func(plr, plrid, neth, "help")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -87,8 +87,8 @@ command_register({
|
|||||||
command = "kickme",
|
command = "kickme",
|
||||||
permission = nil,
|
permission = nil,
|
||||||
usage = "/kickme",
|
usage = "/kickme",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
server.net_kick(sockfd, "requested!")
|
server.net_kick(neth, "requested!")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -96,11 +96,11 @@ command_register({
|
|||||||
command = "me",
|
command = "me",
|
||||||
permission = "me",
|
permission = "me",
|
||||||
usage = "/me <action>",
|
usage = "/me <action>",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) > 0 then
|
if table.getn(prms) > 0 then
|
||||||
net_broadcast(nil, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, 0xFFFFFFFF, "* "..plr.name.." "..string.sub(msg,5)))
|
net_broadcast(nil, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, 0xFFFFFFFF, "* "..plr.name.." "..string.sub(msg,5)))
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"me"})
|
commands["help"].func(plr, plrid, neth, {"me"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -109,7 +109,7 @@ command_register({
|
|||||||
command = "squad",
|
command = "squad",
|
||||||
permission = "squad",
|
permission = "squad",
|
||||||
usage = "/squad <squad name> (Use \"none\" to leave your squad)",
|
usage = "/squad <squad name> (Use \"none\" to leave your squad)",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) > 0 then
|
if table.getn(prms) > 0 then
|
||||||
if prms[1] == "none" then
|
if prms[1] == "none" then
|
||||||
plr.squad = nil
|
plr.squad = nil
|
||||||
@ -118,7 +118,7 @@ command_register({
|
|||||||
end
|
end
|
||||||
plr.update_score()
|
plr.update_score()
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"squad"})
|
commands["help"].func(plr, plrid, neth, {"squad"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -127,11 +127,11 @@ command_register({
|
|||||||
command = "kill",
|
command = "kill",
|
||||||
permission = "kill",
|
permission = "kill",
|
||||||
usage = "/kill",
|
usage = "/kill",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 0 then
|
if table.getn(prms) == 0 then
|
||||||
plr.set_health_damage(0, 0xFF800000, plr.name.." shuffled off this mortal coil", plr)
|
plr.set_health_damage(0, 0xFF800000, plr.name.." shuffled off this mortal coil", plr)
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"kill"})
|
commands["help"].func(plr, plrid, neth, {"kill"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -140,7 +140,7 @@ command_register({
|
|||||||
command = "gmode",
|
command = "gmode",
|
||||||
permission = "gmode",
|
permission = "gmode",
|
||||||
usage = "/gmode #; where 1=normal, 2=spectate, 3=editor",
|
usage = "/gmode #; where 1=normal, 2=spectate, 3=editor",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 1 then
|
if table.getn(prms) == 1 then
|
||||||
local n = math.floor(tonumber(prms[1]) or 0)
|
local n = math.floor(tonumber(prms[1]) or 0)
|
||||||
if n >= 1 and n <= 3 then
|
if n >= 1 and n <= 3 then
|
||||||
@ -148,7 +148,7 @@ command_register({
|
|||||||
plr.update_score()
|
plr.update_score()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
commands.help.func(plr, plrid, sockfd, {"gmode"})
|
commands.help.func(plr, plrid, neth, {"gmode"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -157,7 +157,7 @@ command_register({
|
|||||||
command = "piano",
|
command = "piano",
|
||||||
permission = "piano",
|
permission = "piano",
|
||||||
usage = "/piano <player>",
|
usage = "/piano <player>",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 1 then
|
if table.getn(prms) == 1 then
|
||||||
prms[1] = tostring(prms[1])
|
prms[1] = tostring(prms[1])
|
||||||
if prms[1]:sub(0, 1) == "#" then
|
if prms[1]:sub(0, 1) == "#" then
|
||||||
@ -172,10 +172,10 @@ command_register({
|
|||||||
if target then
|
if target then
|
||||||
target.drop_piano()
|
target.drop_piano()
|
||||||
else
|
else
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: Player not found"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: Player not found"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"piano"})
|
commands["help"].func(plr, plrid, neth, {"piano"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -183,7 +183,7 @@ command_register({
|
|||||||
command = "teleport",
|
command = "teleport",
|
||||||
permission = "teleport",
|
permission = "teleport",
|
||||||
usage = "/teleport <player>|<x y z>",
|
usage = "/teleport <player>|<x y z>",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 1 then
|
if table.getn(prms) == 1 then
|
||||||
prms[1] = tostring(prms[1])
|
prms[1] = tostring(prms[1])
|
||||||
if prms[1]:sub(0, 1) == "#" then
|
if prms[1]:sub(0, 1) == "#" then
|
||||||
@ -201,7 +201,7 @@ command_register({
|
|||||||
net_broadcast(nil, common.net_pack("BBhhh",
|
net_broadcast(nil, common.net_pack("BBhhh",
|
||||||
PKT_PLR_POS, plrid, x * 32.0, y * 32.0, z * 32.0))
|
PKT_PLR_POS, plrid, x * 32.0, y * 32.0, z * 32.0))
|
||||||
else
|
else
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: Player not found"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: Player not found"))
|
||||||
end
|
end
|
||||||
elseif table.getn(prms) == 3 then
|
elseif table.getn(prms) == 3 then
|
||||||
--NOTE: I protest that y is down/same way AoS was
|
--NOTE: I protest that y is down/same way AoS was
|
||||||
@ -210,7 +210,7 @@ command_register({
|
|||||||
net_broadcast(nil, common.net_pack("BBhhh",
|
net_broadcast(nil, common.net_pack("BBhhh",
|
||||||
PKT_PLR_POS, plrid, x * 32.0, y * 32.0, z * 32.0))
|
PKT_PLR_POS, plrid, x * 32.0, y * 32.0, z * 32.0))
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"teleport"})
|
commands["help"].func(plr, plrid, neth, {"teleport"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -220,7 +220,7 @@ command_register({
|
|||||||
command = "goto",
|
command = "goto",
|
||||||
permission = "goto",
|
permission = "goto",
|
||||||
usage = "/goto #X ; where # is letter, X is number in the map's grid system",
|
usage = "/goto #X ; where # is letter, X is number in the map's grid system",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 1 then
|
if table.getn(prms) == 1 then
|
||||||
prms[1] = tostring(prms[1])
|
prms[1] = tostring(prms[1])
|
||||||
local x, z
|
local x, z
|
||||||
@ -235,10 +235,10 @@ command_register({
|
|||||||
net_broadcast(nil, common.net_pack("BBhhh",
|
net_broadcast(nil, common.net_pack("BBhhh",
|
||||||
PKT_PLR_POS, plrid, x * 32.0 + 16, y * 32.0, z * 32.0 + 16))
|
PKT_PLR_POS, plrid, x * 32.0 + 16, y * 32.0, z * 32.0 + 16))
|
||||||
else
|
else
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: Invalid coordinates"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Error: Invalid coordinates"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"goto"})
|
commands["help"].func(plr, plrid, neth, {"goto"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -247,16 +247,16 @@ command_register({
|
|||||||
command = "intel",
|
command = "intel",
|
||||||
permission = "intel",
|
permission = "intel",
|
||||||
usage = "/intel",
|
usage = "/intel",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 0 then
|
if table.getn(prms) == 0 then
|
||||||
local i
|
local i
|
||||||
for i=1,#intent do
|
for i=1,#intent do
|
||||||
if intent[i] ~= nil then
|
if intent[i] ~= nil then
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_text, teams[intent[i].team].name..": "..intent[i].x..", "..intent[i].y..", "..intent[i].z))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_text, teams[intent[i].team].name..": "..intent[i].x..", "..intent[i].y..", "..intent[i].z))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"intel"})
|
commands["help"].func(plr, plrid, neth, {"intel"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -265,7 +265,7 @@ command_register({
|
|||||||
command = "login",
|
command = "login",
|
||||||
permission = nil,
|
permission = nil,
|
||||||
usage = "/login <group> <password>",
|
usage = "/login <group> <password>",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 2 then
|
if table.getn(prms) == 2 then
|
||||||
local success = false
|
local success = false
|
||||||
if permissions[prms[1]] ~= nil and prms[2] == permissions[prms[1]].password then
|
if permissions[prms[1]] ~= nil and prms[2] == permissions[prms[1]].password then
|
||||||
@ -273,12 +273,12 @@ command_register({
|
|||||||
success = true
|
success = true
|
||||||
end
|
end
|
||||||
if success then
|
if success then
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_success, "You have successfully logged in as "..prms[1]))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_success, "You have successfully logged in as "..prms[1]))
|
||||||
else
|
else
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Could not log in to group "..prms[1].." with that password"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_error, "Could not log in to group "..prms[1].." with that password"))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"login"})
|
commands["help"].func(plr, plrid, neth, {"login"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
@ -287,13 +287,13 @@ command_register({
|
|||||||
command = "logout",
|
command = "logout",
|
||||||
permission = "logout",
|
permission = "logout",
|
||||||
usage = "/logout",
|
usage = "/logout",
|
||||||
func = function(plr, plrid, sockfd, prms, msg)
|
func = function(plr, plrid, neth, prms, msg)
|
||||||
if table.getn(prms) == 0 then
|
if table.getn(prms) == 0 then
|
||||||
plr.clear_permissions()
|
plr.clear_permissions()
|
||||||
plr.add_permission_group(permissions["default"].perms)
|
plr.add_permission_group(permissions["default"].perms)
|
||||||
net_send(sockfd, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_success, "You have successfully logged out"))
|
net_send(neth, common.net_pack("BIz", PKT_CHAT_ADD_TEXT, command_colour_success, "You have successfully logged out"))
|
||||||
else
|
else
|
||||||
commands["help"].func(plr, plrid, sockfd, {"logout"})
|
commands["help"].func(plr, plrid, neth, {"logout"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -38,7 +38,7 @@ function new_player(settings)
|
|||||||
this.recoil_amt = 0
|
this.recoil_amt = 0
|
||||||
|
|
||||||
this.pid = settings.pid or error("pid must be set when creating player!")
|
this.pid = settings.pid or error("pid must be set when creating player!")
|
||||||
this.sockfd = settings.sockfd
|
this.neth = settings.neth
|
||||||
this.alive = false
|
this.alive = false
|
||||||
this.spawned = false
|
this.spawned = false
|
||||||
this.zooming = false
|
this.zooming = false
|
||||||
@ -373,11 +373,13 @@ function new_player(settings)
|
|||||||
|
|
||||||
if not server then return end
|
if not server then return end
|
||||||
|
|
||||||
|
print(blocks, oblocks, this.neth)
|
||||||
|
|
||||||
if (blocks == 0) ~= (oblocks == 0) then
|
if (blocks == 0) ~= (oblocks == 0) then
|
||||||
net_broadcast(nil, common.net_pack("BBB",
|
net_broadcast(nil, common.net_pack("BBB",
|
||||||
PKT_PLR_BLK_COUNT, this.pid, this.blocks))
|
PKT_PLR_BLK_COUNT, this.pid, this.blocks))
|
||||||
else
|
else
|
||||||
net_send(this.sockfd, common.net_pack("BBB",
|
net_send(this.neth, common.net_pack("BBB",
|
||||||
PKT_PLR_BLK_COUNT, this.pid, this.blocks))
|
PKT_PLR_BLK_COUNT, this.pid, this.blocks))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
PKT_SNOW_DROP = network.sys_alloc_packet()
|
PKT_SNOW_DROP = network.sys_alloc_packet()
|
||||||
|
|
||||||
network.sys_handle_s2c(PKT_SNOW_DROP, "HHH", function (sockfd, cli, plr, sec_current, x, y, z, pkt)
|
network.sys_handle_s2c(PKT_SNOW_DROP, "HHH", function (neth, cli, plr, sec_current, x, y, z, pkt)
|
||||||
map_block_set(x,y,z,2,255,255,255)
|
map_block_set(x,y,z,2,255,255,255)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user