From c9918aea720257496894e03859f1ae8ab8ec49a8 Mon Sep 17 00:00:00 2001 From: "Ben Russell (300178622)" Date: Sat, 3 Oct 2015 15:36:16 +1300 Subject: [PATCH] clientside portal placement --- pkg/gm/portalgun/gun_portal.lua | 19 ++++++++++++------- pkg/gm/portalgun/main.lua | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/pkg/gm/portalgun/gun_portal.lua b/pkg/gm/portalgun/gun_portal.lua index 7ac2745..96afedf 100644 --- a/pkg/gm/portalgun/gun_portal.lua +++ b/pkg/gm/portalgun/gun_portal.lua @@ -173,6 +173,7 @@ return function (plr) end end + --[==[ if hurt_idx then if server then --[[ @@ -186,13 +187,13 @@ return function (plr) ]] plr.show_hit() end - else - if client then - --[[ - net_send(nil, common.net_pack("BBB" - , PKT_PLR_GUN_HIT, 0, 0)) - ]] - end + end + ]==] + if client then + --[[ + net_send(nil, common.net_pack("BBB" + , PKT_PLR_GUN_HIT, 0, 0)) + ]] if cx2 and cy2 <= ylen-2 and cx2 >= 0 and cx2 < xlen and cz2 >= 0 and cz2 < zlen then print("Portal hit ("..cx2..", "..cy2..", "..cz2..") type "..this.portal_select) @@ -231,6 +232,8 @@ return function (plr) end if valid and dy == 0 and (dx ~= 0 or dz ~= 0) then + plr.show_hit() + plr.portal_list[this.portal_select] = {cx, cy, cz, dx, dy, dz, 0, -1, 0} net_send(nil, common.net_pack("BBBhhhbbbbbb", PKT_PORTALGUN_SET, 0, this.portal_select, cx, cy, cz, dx, dy, dz, 0, -1, 0)) @@ -247,6 +250,8 @@ return function (plr) sx = sx * dy sz = sz * dy + plr.show_hit() + plr.portal_list[this.portal_select] = {cx, cy, cz, dx, dy, dz, sx, 0, sz} net_send(nil, common.net_pack("BBBhhhbbbbbb", PKT_PORTALGUN_SET, 0, this.portal_select, cx, cy, cz, dx, dy, dz, sx, 0, sz)) diff --git a/pkg/gm/portalgun/main.lua b/pkg/gm/portalgun/main.lua index adffc0e..0741868 100644 --- a/pkg/gm/portalgun/main.lua +++ b/pkg/gm/portalgun/main.lua @@ -23,13 +23,13 @@ network.sys_handle_c2s(PKT_PORTALGUN_SET, "BBhhhbbbbbb", nwdec_plrset( if dx == 0 and dy == 0 and dz == 0 then print("SERVER DELETE PORTAL "..portal_select) plr.portal_list[portal_select] = nil - net_broadcast(nil, common.net_pack("BBBhhhbbbbbb", + net_broadcast(neth, common.net_pack("BBBhhhbbbbbb", PKT_PORTALGUN_SET, cli.plrid, portal_select, cx, cy, cz, dx, dy, dz, sx, sy, sz)) else print("SERVER CREATE PORTAL "..portal_select.." AT ("..cx..", "..cy..", "..cz..")") plr.portal_list[portal_select] = {cx, cy, cz, dx, dy, dz, sx, sy, sz} - net_broadcast(nil, common.net_pack("BBBhhhbbbbbb", + net_broadcast(neth, common.net_pack("BBBhhhbbbbbb", PKT_PORTALGUN_SET, cli.plrid, portal_select, cx, cy, cz, dx, dy, dz, sx, sy, sz)) end