@@ -91,9 +91,6 @@ local function broadcastSignal(group, name, scope, sender, filter_player)
9191 end
9292end
9393
94- -- local function table_IsEmpty(t) return not pairs(t)(t) end
95- local function table_IsEmpty (t ) return not next (t ) end
96-
9794local function setGroup (self , group )
9895 -- set the current group to the new group
9996 self .data .signalgroup = group
@@ -241,8 +238,8 @@ __e2setcost(20)
241238
242239--- sends signal S to chips owned by the given player, multiple calls for different players do not overwrite each other
243240e2function void signalSendToPlayer (string name , entity player )
244- if not IsValid (player ) then return end
245- broadcastSignal (self .data .signalgroup , name , 1 , self .entity , player )
241+ if not IsValid (player ) or not player : IsPlayer () then return end
242+ broadcastSignal (self .data .signalgroup , name , 1 , self .entity , player : UniqueID () )
246243end
247244
248245--[[ ************************************************************************]] --
@@ -253,14 +250,16 @@ registerCallback("construct",function(self)
253250end )
254251
255252registerCallback (" destruct" ,function (self )
253+ local receiverid = self .entity :EntIndex ()
254+
256255 -- loop through all scopes, ...
257256 for scope ,groups in pairs_ac (scopes ) do
258257 -- ... all groups ...
259258 for group , signals in pairs_ac (groups ) do
260259 -- ... and all signals ...
261260 for name , contexts in pairs_ac (signals ) do
262261 -- to remove all signals the chip registered for.
263- contexts [self ] = nil
262+ contexts [receiverid ] = nil
264263 end
265264 end
266265 end
0 commit comments