-
Notifications
You must be signed in to change notification settings - Fork 343
Major Update to Wire Map Interface #3351
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
Conversation
- Removed built-in Lua Run functions. When used an error message will be shown in game and the code will not be ran. - Improved compatibility to GMods lua_run entity. You can copy-paste affected code key values to a lua_run entity with no further changes required. - Improved security: Blocked AddOutput and RunPassedCode from user input. It prints an error message instead. - Added additional support for hammer searchers (targetnames beginning with "!") - Added additional Lua globals for lua_run entity context. - Added duplicator and GMod save support with basic anti-tampering. - Added Convars: sv_wire_mapinterface_min_trigger_time, sv_wire_mapinterface_max_sub_entities - Improved stability and reliability. - Improved performance. - Fixed an unnamed number of bugs.
|
The duplicator modifications are my main concern, and then wire_map_interface.lua is very messy. Do we not have a table type that cleans itself when entities are removed? |
|
Are the duplicator modifications so that a duplication can wire itself to the map entities? |
Yes. There can be two cases.
The spawnid used is a hash of the map creation id, map name and the id of the info_wiremapinterface it is being assigned too. It is needed so the entities knows to which Entities being duped lose their map creation id, so I need to remember it when duped. It is hashed with the other parameters to prevent issues when duped across maps. The hash is used for data validation too. If something doesn't fit the entity will not be assigned to the Remember: The The As a map controlled entity, the The duplicator logic in the entities being assigned to the
All three cases are important to make dupe support fully reliable, because when duped the entity might not have wire ports yet. In fact the pasted entity might not even be fully initialized as wire able entity yet (just a prop) when Wiremod/dupe attempts to connect to it. The initialization will only run once per entity is only done when it has the |
The table is a look up table between the custom spawn id ( A table that cleans itself? You mean setting a metatable with a I am not sure if this was available in all GMod branches. So far I know the the weak table does not detect entities going invalid ( In short the logic is debounced and does not get spammed. |
|
No, not __mode, but CallOnRemove or EntityRemoved hooks. It might be cleaner to not use lookup tables at all but I'll have to look closer. |
| self:CallOnRemove("WireMapInterface_OnRemove", function(this) | ||
| if this._WMI_RemoveOverrides then | ||
| this:_WMI_RemoveOverrides() | ||
| end | ||
| end) | ||
| end |
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.
No, not __mode, but CallOnRemove or EntityRemoved hooks. It might be cleaner to not use lookup tables at all but I'll have to look closer.
Yeah, CallOnRemove is already a thing. That clean up thing is more of a backup thing to make sure there would absolutely no way it could leak memory. I don't think it is not possible to avoid the lookup table in this case.
| local spawnIdDuped = WIREENT._WMI_GetSpawnIdDuped(self, interfaceEnt) | ||
| local mapId = WIREENT._WMI_MapCreationIdDuped(self) | ||
|
|
||
| WireLib.UnregisterWireMapInterfaceSpawnId(spawnId, spawnIdDuped, mapId, self) |
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.
That's where it is called to unregister itself from the lookup table. WIREENT:_WMI_RemoveOverrides is called if the entity is removed or is being unassigned from it's info_wiremapinterface.
Co-authored-by: thegrb93 <[email protected]>
Co-authored-by: thegrb93 <[email protected]>
Co-Authored-By: thegrb93 <[email protected]>
|
I think the dupe changes look ok, but I'll look closer soon. |
Co-authored-by: thegrb93 <[email protected]>
|
Will look at cl_wire_map_interface soon. There's some performance concerns there. |
Co-authored-by: thegrb93 <[email protected]>
Co-authored-by: thegrb93 <[email protected]>
Co-authored-by: thegrb93 <[email protected]>
|
Hello all! There's a lot back and forth with this PR, and I'm stepping in and putting the discussion on hold here on github. This is not a PR block, nor is it a PR push, rather its mediation time. I'll be working on trying to get a good roundtable going in discord so that people dont need to keep repeating themselves, and brainstorm if there are simple solutions to the concerns raised. This is in an effort to keep peace, and also give the PR a fair shake for discussion. Even if one still has access, please do not post further comments until unlocked. |
|
This PR has been discussed at a roundtable, and is preemptively approved for merger. The only reason this PR can now be blocked is for any serious unsolvable technical/security issue. |
Co-Authored-By: Redox <[email protected]>
| local inputNameLower = string.lower(inputName) | ||
|
|
||
| local params = output.param or "" | ||
| if params ~= "" then |
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.
Same with params, doesn't seem to get used elsewhere? Could do if (output.param or "") ~= "" then if Lua supports that.
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.
I don't know, it seems a little ugly to me.
Co-Authored-By: DarthTealc <[email protected]>
Co-Authored-By: DarthTealc <[email protected]>
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 to me. Can't spot any obvious issues with the code that haven't already been fixed, and my previous test of the test map had no lua errors or functionality issues. Can't really input on wire-oriented exploits or map implementation as I'm not a mapper, but seems to have checks to abort in cases where maps have implemented things in a dangerous way so it shouldn't be possible to run arbitrary lua.



There it is, like after 4 weeks in the making after a ton of testing. First major rewrite of the Wire Map Interface after I made the first version 10+ years ago.
About:
https://github.com/wiremod/wire/wiki/Wire-Map-Interface
Changes:
E:Wirelink()does not work.Demo Videos (slightly outdated):
2025-05-29_21-26-21.mp4
2025-05-29_21-23-59.mp4
Used E2 code:
Demo Map:
This pull request can be tested with this custom demo/test map, vmf included:
gm_wiremapinterface_v1-1.zip
It contains most use cases and test setup for the Wire Map Interface. You can use it for testing and learning how this system works and how it can be used.
Additional request and permission
I would also like to request to ship the map + vmf as an official part of Wiremod either in the main repository or as an additional addon from the Wire Team. I think that will help getting people more familiar with this feature.
I give full permission to use, modify and release/reupload the map, its source or any part of it when ever you like.
Notes: