-
Notifications
You must be signed in to change notification settings - Fork 22
Control and item fixes for spectators AND env_screenoverlay patch #295
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
base: master
Are you sure you want to change the base?
Conversation
When a player join spectators: - Fired ForceDropOfCarriedPhysObjects input to fix stucked in air physics objects and controlled func_tank like entities. - Called RemoveAllItems() for cases if they're not removed (somehow).
Added: - Input hooks for custom logic. - New inputs "StartOverlaysForEveryone" and "StopOverlaysForEveryone". - Globals to control overlay values for each player. - Enable/disable an env_screenoverlay on cllient connect/disconnect (NOT TESTED). - New methods in CBaseEntity methodmap: getter and setter to response context, getter and setter for texture frame index. - Added new methodmap CEnvScreenOverlay.
Needs to be used for every array with MAXPLAYERS.
|
Hope this is the last thing I forgot. |
Replaced MAXPLAYERS with MAX_PLAYERS
Alienmario
left a comment
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’ll begin with some general recommendations. Once those are addressed, we can move on to the concrete implementation. I hope this is understandable.
- Try to keep comments concise and to the point. If the code is self explaining (i.e by names or strings), then comments are usually not necessary.
- Try to keep separate PRs for individual issues or enhancements.
- Try to maintain consistent formatting, mainly this
if(toif (. - Rename
ForEveryonepostfix toAllfor consistency with other modified entities. - Instead of hijacking entity datamaps for custom properties, GetUserData*, SetUserData* methods from CBaseEntity methodmap may be used.
- srccoop_api and any classdefs in it are meant to used by independent plugins. Any plugin variables added there will not be 'synced'. Move patch functionality to core plugin space.
- using MAX_PLAYERS over MAXPLAYERS is going to be confusing to anyone who's been making SM plugins for a long time. Do you have a significant reason for doing this?
| //------------------------------------------------------ | ||
| public Action Timer_EnvScreenOverlayThink(Handle timer, CEnvScreenOverlay pScreenOverlay) | ||
| { | ||
| if(!IsValidEntity(pScreenOverlay.entindex) || pScreenOverlay.GetActiveState() == false) |
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.
Use .IsValid() method
| { | ||
| if(!IsValidEntity(pScreenOverlay.entindex) || pScreenOverlay.GetActiveState() == false) | ||
| { | ||
| if (timer != null) |
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.
timer is always non-null
I noticed that with MAXPLAYERS the array size is going to be 101 always, while bms supports only 33 players at once, so basically the version for bms will take tones of memory that could be used for other things, and I think it's generally not okay to take memory that is never used. I used MAX_PLAYERS for now cuz it's the shortest name i could give for it.
That was in my original plan (cuz it's short), but i renamed both cuz (it seemed to me) ForEveryone is a more intuitive name, I'll rename it.
But I'm also using some custom inputs in the methodmap, should I just use a macro for them? |
That's like a raindrop in a river - not significant enough to sacrifice readability.
Macros will not help here. |
@ampreeT give me your opinion on this before I will do any changes. |
All of the default plugins that SourceMod ships with uses |
Actually, if you're able to convert all variables into 'entity user data' calling methods, it may not be necessary to create the extra file. We may just be able to implement cross-plugin sharing since those are backed by a single IntMap. |
When a player join spectators:
Added env_screenoverlay patch that solves #284:
IMPORTANT:
env_screenoverlay path needs few tests with real players (2 or more).