Simple solution?

This commit is contained in:
Electra
2024-08-10 04:47:35 -04:00
parent 97e17edfae
commit 2c75f0bc9c

View File

@@ -716,9 +716,18 @@ function Player:extraEvent(eventName,...)
return return
end end
-- Write to stream local human = nil
if self.type=='human' then -- Trigger for all non-remote players
ins(GAME.rep,self.frameRun) for _,p in next,PLAYERS do
if p.type ~= 'remote' then
if p.type == 'human' then
human = p
end
self.gameEnv.extraEventHandler[eventName](p,self,...)
end
end
ins(GAME.rep,human.frameRun)
ins(GAME.rep,64+eventID) ins(GAME.rep,64+eventID)
ins(GAME.rep,self.sid) ins(GAME.rep,self.sid)
local data={...} local data={...}
@@ -727,14 +736,6 @@ function Player:extraEvent(eventName,...)
end end
end end
-- Trigger for all non-remote players
for _,p in next,PLAYERS do
if p.type~='remote' then
self.gameEnv.extraEventHandler[eventName](p,self,...)
end
end
end
function Player:getHolePos()-- Get a good garbage-line hole position function Player:getHolePos()-- Get a good garbage-line hole position
if self.garbageBeneath==0 then if self.garbageBeneath==0 then
return generateLine(self.holeRND:random(10)) return generateLine(self.holeRND:random(10))
@@ -2731,7 +2732,6 @@ local function update_streaming(P)
P.streamProgress=P.streamProgress+eventParamCount+1 P.streamProgress=P.streamProgress+eventParamCount+1
local SRC local SRC
local SELF
for _,p in next,PLAYERS do for _,p in next,PLAYERS do
if P==sourceSid and p.sid==sourceSid then if P==sourceSid and p.sid==sourceSid then
SRC=p SRC=p
@@ -2739,22 +2739,7 @@ local function update_streaming(P)
end end
end end
if SRC then if SRC then
for _,p in next,PLAYERS do P.gameEnv.extraEventHandler[eventName](P,SRC,unpack(paramList))
if p.type=='human' then
SELF=p
break
end
end
SELF.gameEnv.extraEventHandler[eventName](SRC,SELF,unpack(paramList))
-- Write to stream
if SELF.type=='human' then
ins(GAME.rep,SELF.frameRun)
ins(GAME.rep,event)
ins(GAME.rep,SELF.sid)
for i=1,#paramList do
ins(GAME.rep,paramList[i])
end
end
end end
end end
P.streamProgress=P.streamProgress+2 P.streamProgress=P.streamProgress+2