-
Notifications
You must be signed in to change notification settings - Fork 141
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
vscript vgui #169
vscript vgui #169
Conversation
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.
There are minor fomatting issues with inconsistent spacing around parenthesis in control-flow statements and function parameters. It's not really concerning, just pointing it out.
Missing spaces after SCRIPT_SINGLETON
(BEGIN_SCRIPTDESC_ROOT_NAMED()
) also caught my eye.
The name of _panel
diverges from the more common style (m_pPanel
), though it has precedent in the original VGUI code.
This and m_hScriptInstance
have accessors and could become private
; I think only ResolveChildren()
would need to be modified, either by being friend
ed or by becoming a static method of IScriptVGUIObject
. Again, just pointing it out.
There are a couple of loops to search for matching panels in g_ScriptPanels
. That could be refactored to a function.
There are two unrelated changes in sp/src/game/client/vscript_client.cpp
which should get their own dedicated commit (replacement of loop with V_memset()
and removal of a call to g_pScriptVM->ClearValue( m_ScriptScope, "entity" )
in CScriptMaterialProxy::OnBind()
).
There are a couple of places where references to a static Vector
is returned.
I'm not sure how the script FFI deals with these - if a script were to call it twice, would both variables in the script also refer to the same object? I.e. would something like this fail:
local top = ScreenToWorld(0.5, 0);
local bottom = ScreenToWorld(0.5, 1);
assert( top != bottom );
Returned Vectors to script functions are reallocated in the VM, returning static Vector is Valve's convention. Though testing local Vector return, it seems to work fine; perhaps it's a difference in the implementation, or I'm forgetting something. I will push some changes later. |
38e55c3
to
fe85564
Compare
fe85564
to
92f13c0
Compare
92f13c0
to
76dc70e
Compare
4b4b0d3
to
a6dba10
Compare
a6dba10
to
ea374fd
Compare
1a8806e
to
dd8314f
Compare
dd8314f
to
04e59c8
Compare
09065cb
to
368796a
Compare
68c63d0
to
36dd406
Compare
36dd406
to
01ffbce
Compare
bdd338f
to
7cceb59
Compare
7cceb59
to
36fb1a7
Compare
da9c199
to
47de7f3
Compare
47de7f3
to
0943fe0
Compare
0943fe0
to
1d680e5
Compare
1d680e5
to
4f9184b
Compare
4f9184b
to
70d4c5a
Compare
70d4c5a
to
561c0e5
Compare
3a03270
to
a99772f
Compare
a99772f
to
2013089
Compare
90bde54
to
dd506bc
Compare
dd506bc
to
c2d7f12
Compare
8af034b
to
fd61521
Compare
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.
There's not any practical way for me to test everything this has, although I did try using the HUD replacement scripts from your repo and messed around with the save icon script you provided. I experienced an Overflowed reading usercmd data (check sending and receiving code for mismatches)!
error from the fake Steam client, which I'm assuming isn't related to the VScript VGUI code itself, but I'm otherwise in agreement that this seems stable. Before I approve this, I'm requesting a change I had to make for it to compile on my machine.
I'm really blown away by the capabilities of this implementation. This has the potential to open custom VGUI creation to a much wider audience.
Should the function to set overrides/callbacks be named
SetCallback()
, or something else? Panorama usesSetPanelEvent()
for registering callbacks.
The context of SetCallback
is specific enough that I think the name works best as-is than it would as something more explicit.
fd61521
to
af204d6
Compare
The Steam notifications & achievements code works fine, are you sure you've included it on both server and client, and there are no errors on server? That error happens when client sends a message and server doesn't receive it. I also updated that code for save/restore few days ago (and rebased because they're code for an unreleased WIP feature so I don't care about history), although unlikely, you might have used a broken version. Additionally I removed Not too worried about temporarily removing this because it's already possible to manually calculate this. |
Ah, I didn't realize it was meant to run on both the server and the client. I saw that the save icon script was client only and I didn't realize your other HUD scripts were meant to be shared. I'm surprised I missed that, but sorry for the confusion. |
The Steam scripts are only shared for the achievement manager (serverside control and verification), and the HUD scripts are shared to be able to get suit information because NetProps doesn't work. |
af204d6
to
124ebc0
Compare
124ebc0
to
6fc2f1c
Compare
6fc2f1c
to
b5ba3f6
Compare
…vgui vscript vgui
This implementation is not final, but it is stable.
Example code and videos:
https://github.com/samisalreadytaken/vscripts/tree/master/mapbase
https://gist.github.com/samisalreadytaken/4847ede81a7222b66dc82eac8622904e
https://youtu.be/PrND1JsXduo
https://youtu.be/I4Y_kLR2CQ0
https://youtu.be/Oh5JpBHXWYM
Some notes:
Most
#if 0
'd blocks are either untested, or usefulness of them are uncertain.Should the function to set overrides/callbacks be named
SetCallback()
, or something else? Panorama usesSetPanelEvent()
for registering callbacks.A future change to add is integration with
C_VGuiScreen
entity to display script panels. This would also be a simpler alternative to manual 3D world painting.A TODO is a convenient method to control the visibility of existing HUD elements. The current hack is to use the
hidehud
convar which is manually reset on level shutdown. (See hud_override.nut)PR Checklist
develop
branch OR targets another branch with a specific goal in mind