-
-
Couldn't load subscription status.
- Fork 496
Transfer box customization #171
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
Transfer box customization #171
Conversation
example script: https://pastebin.com/Ny153ayg This event allow to overwrite currently transfer box into your custom. Arguments are current progress and total size in Bytes
|
Also as the event only sends the
But you only do the 2nd point. |
Fixed typo,
Removed unneded argument in method `Hide`
Added another argument at the beginning which say status `show` `progress` and `hide`
New example script:
```lua
addEventHandler ( "onTransferBoxProgressChange", localPlayer,function(typ,current,total)
cancelEvent() -- disable current transfer box
outputChatBox(inspect({typ,current,total}))
end)
```
output
```
{ "show" }
{ "progress", 446094, 8921880 }
{ "progress", 669141, 8921880 }
{ "progress", 1115235, 8921880 }
{ "progress", 1784376, 8921880 }
{ "progress", 8921880, 8921880 }
{ "progress", 8921880, 8921880 }
{ "hide" }
```
This comment has been minimized.
This comment has been minimized.
|
Can we discuss about the name of that event instead of changing it back and forth ?
With that in mind, I don't see why we should stick with I'm up for any discussion. |
|
@Citizen01 I agree, but my code was more about correctness, because the supplied code prior to the changes didn't work. Furthermore, I would prefer two functions to control/get the visibility of the transfer window instead of cancelling the event. |
I agree but if we do so, can the transfer box still flash in the screen if the timing isn't right ? |
|
I love the idea of giving scripters some control over the transfer progress GUI, because it is needed to integrate it visually with a scripted, custom GUI system, for example. However, this also allows the potential for scripters to hide the player how much bytes were downloaded from a server, which can be a concern when playing under metered connections. I think it'd be ideal to enforce MTA to display that information no matter what, and then allow scripters to build their own things on top of that if they want to. Maybe some subtle DirectX text in some place can do it when the event is cancelled. |
|
@AlexTMjugador Or combine this feature with pull request #154 (Added size column in the server list) |
|
That'd be great for me, @Necktrox 👍 . A win-win for everyone. About the event cancelling, I also think it'd be more appropiate to just provide two functions: one to set the hide status of the transfer window, and another to get it. It's not that hiding it by cancelling the event is incorrect, but in my opinion script logic can get easier the other way. If several scripts want to hide the transfer window, they can call that function once, and if the event triggers then they know that it's because other script enabled it back on. In the case that they didn't have that function, those scripts would have to keep track of the related operations of other scripts more actively to know that, which would lead to more complex and therefore less mantainable code. Edit: Moreover, if the event is called |
|
@Necktrox I understand the concerns for the size of the download still being known to the player, however, the scripter can easily work around this anyway. Simply don't put any files to be downloaded in the meta.xml and then download them using for example triggerLatentClientEvent. |
|
I haven't looked at the code or considered whether this feature is suitable. To answeer one of the things mentioned...
There should be an MTA setting to prevent the server from controlling the transfer box: With the box unchecked, |
pls don't nuke
…into onTransferBoxStateChange-event
* Create and use new allow_server_control_transferbox setting * Toggling between custom and native transfer box works by clicking on the checkbox mid-transfer too, unless client is hanging of course * Add onClientTransferBoxProgressChange event * Use const where possible * Use CGUI class as the base for enabled state of transfer box instead of duplicating logic over to CTransferBox (which didn't even work) * Don't reset transfer total size in Show function, it breaks when toggling the setting off, * Clean up project comments, clang format
Changes addressed. New review of course would be great!
Summary
Requesting scripting feedback
Personally, I don't think this feature is required per se, but I don't mind having it around for more custom loading screens. Anything else we've missed? |
My silence on this PR (outside general code review) is due to the fact I am not so sure this feature is a good idea. |
I don't see any reason for concern. People have been requesting this for ages. They just want to create better looking loading screens. Other games support this, take Garry's Mod for example. What's the worst that could happen? |
Better loading screens would indeed be nice, and I would be open to discussing such a proposal. However, the functions introduced in this pull request can't be used to implement better looking loading screens as client resources do not initially run until they have all been downloaded. Thinking about it for a long while now, I don't see any harm in this PR. Some notes:
... sorry for taking so long... |
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 merged master in. hopefully i did it correctly. i didn't shift the GUI checkbox around, so someone needs to do that.
|
Will we have any update about this? I think we wouldn't even need a checkbox to confirm whether or not the server can handle the transferbox, i think ideal would be that if the server disables it, it would be visible anyway by pressing esc, that is: allow the servers to use "setTransferBoxEnabled" but this effect would not apply to the main menu |
Based on pull request multitheftauto#171 by CrosRoad95
|
Let's move to the latest, further and actively developed PR at #1955. Thank you for your ground work @CrosRoad95 |
This event allow to overwrite currently transfer box into your custom.
Event:
onTransferBoxProgressChangearguments: int downloaded, int total ( both in bytes, total == 1024 == 1KB )functions:
bool setTransferBoxEnabled( bool enabled )show/hide default transfer box, by default: truebool isTransferBoxEnabled( )return true if default transfer box is enabled, false otherwise.example script that show current progress of downloading on chat, default transferbox doesn't appear
Then when you restart resource and new resources start downloading, script will show:
tested on acpanel above.
Edit.
Added option to give/take server option to control transfer box