-
Notifications
You must be signed in to change notification settings - Fork 355
Fix small Wire runtime edge cases #3649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3ff85cc
a2a9973
dba9842
5fe8d32
452f574
44fe4aa
8c1dbef
bae45a9
3d8a8b6
d08c3bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,9 +91,6 @@ local function broadcastSignal(group, name, scope, sender, filter_player) | |
| end | ||
| end | ||
|
|
||
| --local function table_IsEmpty(t) return not pairs(t)(t) end | ||
| local function table_IsEmpty(t) return not next(t) end | ||
|
|
||
| local function setGroup(self, group) | ||
| -- set the current group to the new group | ||
| self.data.signalgroup = group | ||
|
|
@@ -241,8 +238,8 @@ __e2setcost(20) | |
|
|
||
| --- sends signal S to chips owned by the given player, multiple calls for different players do not overwrite each other | ||
| e2function void signalSendToPlayer(string name, entity player) | ||
| if not IsValid(player) then return end | ||
| broadcastSignal(self.data.signalgroup, name, 1, self.entity, player) | ||
| if not IsValid(player) or not player:IsPlayer() then return end | ||
| broadcastSignal(self.data.signalgroup, name, 1, self.entity, player:UniqueID()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not passed. As far as I have been told player:UniqueID() is not expected there. This needs testing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks correct
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright. |
||
| end | ||
|
|
||
| --[[************************************************************************]]-- | ||
|
|
@@ -253,14 +250,16 @@ registerCallback("construct",function(self) | |
| end) | ||
|
|
||
| registerCallback("destruct",function(self) | ||
| local receiverid = self.entity:EntIndex() | ||
|
|
||
| -- loop through all scopes, ... | ||
| for scope,groups in pairs_ac(scopes) do | ||
| -- ... all groups ... | ||
| for group, signals in pairs_ac(groups) do | ||
| -- ... and all signals ... | ||
| for name, contexts in pairs_ac(signals) do | ||
| -- to remove all signals the chip registered for. | ||
| contexts[self] = nil | ||
| contexts[receiverid] = nil | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not passed. I am too unsure about that one too. This needs testing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine, I guess. |
||
| end | ||
| end | ||
| end | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is all wrong. Please change it back to how it was in the first pr.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This gets difficult to keep track of, lol. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,10 +49,15 @@ if SERVER then | |
| local data = table.concat(tbl) | ||
|
|
||
| if #data < 4096 then | ||
| data = util.Compress(data) | ||
| local compressed = util.Compress(data) | ||
| net.WriteBool(false) | ||
| net.WriteUInt(#data, 12) | ||
| net.WriteData(data) | ||
|
|
||
| if compressed then | ||
| net.WriteUInt(#compressed, 12) | ||
| net.WriteData(compressed) | ||
| else | ||
| net.WriteUInt(0, 12) | ||
| end | ||
|
Comment on lines
+52
to
+60
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the receiver reflect these changes too? I don't see it in this PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good to me now |
||
| else | ||
| net.WriteBool(true) | ||
| net.WriteStream(data, nil, false) | ||
|
|
@@ -207,4 +212,4 @@ function Net.Trivial.Receive(name, callback) | |
| update_handlers(name:lower(), callback) | ||
| end | ||
|
|
||
| Net.Receivers = registered_handlers | ||
| Net.Receivers = registered_handlers | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed. But I would avoid adding more stuff during the review process. This change can stay in, though.