Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR mainly fully implements
CNetMsgScriptHelper
for custom network message communication, but also adds clientsidedebugoverlay
(that I had planned to include previously but forgot about),CBaseEntity::SetContextThink
for more complex thinking from script, fixes user script execution order and clientside player script instance registration, moves all documentation under the__Documentation
namespace from global scope, and some misc improvements.A (not necessarily good) example of server to client, then client to server messaging below. The server queries the screen position of a world vector, client responds with the screen position to server to draw on client's screen with debugoverlay. This example simulates the
debugoverlay.EntityTextAtPosition
functionality usingScreenText
.Or simply call a clientside function
The security of this communication in multiplayer depends all on the user. Clients cannot execute arbitrary code on server, and the sender is passed to the reciver function so the user can check if the client has permissions to run whatever to run.
The logic of script context thinking differs from Source 2. In Source 2, the execution order of added think functions are not serial, and change depending on the context name; in my implementation it follows the added order.
For example executing the snippet below in Source 2 will print "231", while here it is "123"
Passing
null
instead of a closure stops thinking.CBaseEntity::SetThink
now internally executes SetContextThink with an empty context.IScriptVM::Get/Set/ClearValue
additions are something Valve should have already implemented. They allow accession of any type as table keys instead of just strings, and also allow script array modification.With the addition of hash maps for the save/restore tables and event listeners, I removed the context length limit as the strings are no longer allocated. Event lookup on WriteEventData should also now be much faster.
PR Checklist
develop
branch OR targets another branch with a specific goal in mind