-
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
base: master
Are you sure you want to change the base?
Changes from all commits
3ff85cc
a2a9973
dba9842
5fe8d32
452f574
44fe4aa
8c1dbef
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 | ||
|
|
||
|
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. Passed. But I would avoid adding more stuff during the review process. This change can stay in, though. |
||
| 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,14 @@ 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
+59
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 +211,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.
How does the "other side" deal with the change? Was it somehow compensated? Can the hardcoded slash be removed or moved to the receiver?
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.
The trailing forward-slash was getting trimmed before but now it's not.
wire/lua/entities/gmod_wire_expression2/core/files.lua
Line 447 in fd918b3
Should test that this change in behavior is ok.
There's another bug on line 95 I just noticed where non-txt files will cause a mismatch in amount of data written and number of files specified at line 93.
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.
If this is tested, I would give it a pass.
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.
Tested the file list roundtrip in GMod with file and folder entries. The folder keeps the trailing
/, and the count now only includes the transmitted.txtfiles, so non-txt files do not shift the receiver.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.
@thegrb93 What do you thing? It seems to be the only point left before passing.
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.
Looks good, thanks.
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.
With that being said I have no concerns left about this PR.