Fix small Wire runtime edge cases#3649
Conversation
There was a problem hiding this comment.
I don't think this is necessary.
The != operator is provided by garry's mod, we should have a gmod-based linter already in here.
Your LLM may not have context to understand that the language is a modified version to include c-style operators.
Make sure that changes like these don't appear in PRs as its considered a "style change" which is not necessary in a feature-based PR, more so a different PR would be required for this.
This can make histories difficult to view in blame as well, I suggest reverting this.
There was a problem hiding this comment.
ok thanks thats not mine fix i deleted
|
Also if PR's are still in progress, i.e. your still finding things to change, you should make it a draft, its there to help you before releasing to the public to review. |
Grocel
left a comment
There was a problem hiding this comment.
Please separate "Passed" and "OK" changes into a new PR. Keep the "Unsure" and questionable changes to this PR.
| 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()) |
There was a problem hiding this comment.
Not passed. As far as I have been told player:UniqueID() is not expected there. This needs testing.
There was a problem hiding this comment.
| for name, contexts in pairs_ac(signals) do | ||
| -- to remove all signals the chip registered for. | ||
| contexts[self] = nil | ||
| contexts[receiverid] = nil |
There was a problem hiding this comment.
Not passed. I am too unsure about that one too. This needs testing.
There was a problem hiding this comment.
| "gitrid.sh", | ||
| "LICENSE", | ||
| "wiremod.*" | ||
| "wiremod.*", |
| 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 |
There was a problem hiding this comment.
Does the receiver reflect these changes too? I don't see it in this PR.
| local sent = scripted_ents.Get(Data.Class) | ||
| if not sent or not sent.ClassName then return false end | ||
|
|
||
| Data.Class = sent.ClassName |
| local folder = fop .. "/" | ||
| net.WriteUInt(#folder, 16) | ||
| net.WriteData(folder) |
There was a problem hiding this comment.
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.
The trailing forward-slash was getting trimmed before but now it's not.
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.
If this is tested, I would give it a pass.
There was a problem hiding this comment.
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 .txt files, so non-txt files do not shift the receiver.
There was a problem hiding this comment.
@thegrb93 What do you thing? It seems to be the only point left before passing.
| local x,y,z = string.match( val, "^ *([^%s,]+) *, *([^%s,]+) *$" ) | ||
| if x and y and z then return x..", "..y..", "..z end | ||
| local x,y = string.match( val, "^ *([^%s,]+) *, *([^%s,]+) *$" ) | ||
| if x and y then return x..", "..y end |
| local tempVal = castE2TypeToWireValueType["VECTOR4"](val[2], typeID(val[2])) | ||
| if not tempVal then return "Incorrect 'value' parameter #"..i.." value! Expected 'VECTOR2'. Got: "..tostring(val[2]) end | ||
| local tempVal = castE2TypeToWireValueType["VECTOR4"](val, TypeID(val)) | ||
| if not tempVal then return "Incorrect 'value' parameter #"..i.." value! Expected 'VECTOR4'. Got: "..tostring(val[2]) end |
| val = {wireValueType, CastFunc(val[2], TypeID(val[2]))} | ||
| elseif #val == 2 then -- vector2 | ||
| local tempVal = castE2TypeToWireValueType["VECTOR2"](val[2], typeID(val[2])) | ||
| local tempVal = castE2TypeToWireValueType["VECTOR2"](val, TypeID(val)) |
| elseif e2TypeID == TYPE_ANGLE then val = {"ANGLE", castE2TypeToWireValueType["ANGLE"](val, e2TypeID)} | ||
| elseif e2TypeID == TYPE_STRING then val = {"STRING", castE2TypeToWireValueType["STRING"](val, e2TypeID)} | ||
| else return "Incorrect 'value' parameter #"..i.." type! Expected table (Ex. table(\"normal\", 0)). Got: "..type( steamid ) end | ||
| else return "Incorrect 'value' parameter #"..i.." type! Expected table (Ex. table(\"normal\", 0)). Got: "..type( val ) end |
There was a problem hiding this comment.
There was steamid before? Strange. Looks ok, though.
|
Pushed a small WireNet update so the handler-name update stays inline if compression fails or does not fit the 12-bit path. Tested in GMod on gm_construct: signalSendToPlayer delivery, signal listener cleanup on chip removal, E2 file list roundtrip with file + folder entries, and WireLib.Net.Trivial normal/nil-compress/too-large-compress cases. Should be ready for another look. |
There was a problem hiding this comment.
This is all wrong. Please change it back to how it was in the first pr.
There was a problem hiding this comment.
This gets difficult to keep track of, lol.
| for name, contexts in pairs_ac(signals) do | ||
| -- to remove all signals the chip registered for. | ||
| contexts[self] = nil | ||
| contexts[receiverid] = nil |
| 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()) |
There was a problem hiding this comment.
This gets difficult to keep track of, lol.
| local folder = fop .. "/" | ||
| net.WriteUInt(#folder, 16) | ||
| net.WriteData(folder) |
There was a problem hiding this comment.
If this is tested, I would give it a pass.
|
|
||
| --local function table_IsEmpty(t) return not pairs(t)(t) end | ||
| local function table_IsEmpty(t) return not next(t) end | ||
|
|
There was a problem hiding this comment.
Passed. But I would avoid adding more stuff during the review process. This change can stay in, though.
|
@ShiroKSH once you feel everything about these guys have been addressed according to Grocel, simply change this to open state, and they can have the final say on merge, which from how this looks is 100% going to happen. |
ye i knew ty <3 |
splited
remaining unsure changes