-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add ability for admins to change certain cvars via command. #35105
base: master
Are you sure you want to change the base?
Conversation
You've listed the reason as: "This is useful if you do not want to give everyone +HOST for simple playercount changes." Could you explain why this is tied to admin privilages and not its own privilage? Do all admins need the ability to do this? |
Every CVar can choose its own permission flag. The command is there so you don't have 30 commands that all just flip a cvar. I just listed this as an example. |
This PR was made specifically after Slam wanted a way to playtest damage values via CVars. He then brought up making a set of commands (Much boilerplate) to change the damage values. I suggested making something like this instead, to which he requested me to do as he was going on vacation. And now here we are. |
Not needed as the command checks for the perms.
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, thanks for the help! ❤️
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.
Search tested nicely! Good QoL!
LoC does not work at the earlier stages of server initalization
We clear out list so its no longer needed
Why is a new command needed for this? Can't you just make the existing command not require HOST ? |
The existing command is in engine and admin flags are in content. |
To further explain: |
Having two commands that have the exact same function but with different permissions seems a bit hacky. Wouldn't it be better to have a permissions system in the engine instead? |
Yes, I agree that the commands share functionality, but implemting a permission system in RT is a much higher workload and might not even be watned. Also RT supports singleplayer. How would it work with that? |
Yeah this isn't a feature that should be in RT. |
Requires space-wizards/RobustToolbox#5674
About the PR
Adds a command that downstreams can use to allow more fine grained control about cvar changes.
Why / Balance
Currently, the only way to change CVars is via the config files or the
cvar
command which is +HOST only. +HOST is a dangerous permission to give. This PR adds a framework to allow certain CVars to be changed simply via thechangecvar
content command. The CVars define their own min and max as well as the AdminFlag required to execute the command.This is to allow config changes (such as playercount, for example) from admins that do not have +HOST. It will also reduce boilerplate code (see https://github.com/space-wizards/space-station-14/blob/master/Content.Server/Administration/Commands/PanicBunkerCommand.cs as an example). This PR does not actually add any CVars to the list as this is only the framework to do it.
Possible CVars to allow changing in the future:
clientsidemappingsetup
command.Technical details
This PR adds a new command. The command fetches all CVars that can be changed via reflection once autocomplete is attempted. Why not on command creation?
IPostInjectInit
does not trigger on commands and dependencies are not available on construction.Media
Screenshots are slightly outdated.
![image](https://private-user-images.githubusercontent.com/63975668/412356916-61e395b0-7e6d-41da-9611-8f59e6df62d8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1ODU1OTIsIm5iZiI6MTczOTU4NTI5MiwicGF0aCI6Ii82Mzk3NTY2OC80MTIzNTY5MTYtNjFlMzk1YjAtN2U2ZC00MWRhLTk2MTEtOGY1OWU2ZGY2MmQ4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDAyMDgxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ5ZjNhYWNmNTA1M2U0MGZjM2FkMDE1NzZkYTA2NGQ5ZjkwYTk3Njc2YTAwMjY2NDRmOGY5MWNjZmZmNjBkODUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5iAnXO4zcYjX3Wgh_cFeloavnBZbAgybFWd1nH-jIPk)
![image](https://private-user-images.githubusercontent.com/63975668/412356976-bf8f0372-e8bf-4d0f-b7d1-cdbfe5e70d91.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZ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tei1EYXRlPTIwMjUwMjE1VDAyMDgxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUyYmI5NTVkNzc5YTQ3YjQzYjQyZDlmOTE1NTBmYWQ1NmIyMGZmY2ZmYzVhMTVmMWJmNmE0YmZiYTI0Y2UzNDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ckEIG3lXRmZL3_082FpkYbcsgwpz_nv6EHa4v1YSvMg)
![image](https://private-user-images.githubusercontent.com/63975668/412357197-096947eb-3808-4add-ae5f-f67646705e21.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1ODU1OTIsIm5iZiI6MTczOTU4NTI5MiwicGF0aCI6Ii82Mzk3NTY2OC80MTIzNTcxOTctMDk2OTQ3ZWItMzgwOC00YWRkLWFlNWYtZjY3NjQ2NzA1ZTIxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDAyMDgxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI3Zjc4OGM4OTA4YzlmZDMxNTJiZDJlYzE3NzkyYzQ5MDA0YTRhMThkMGRkZmNmN2I5MzQ1NzViMjFhMzNlYjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.7mHFE3RqlMZ1NX334SktZF25mXdzFOY2uy88QGKcJOc)
Requirements
Breaking changes
(This is not breaking changes, just an FYI for forks!)
A new command
changecvar
has been added to allow non +HOST admins to change CVar values. To achieve this add the[CVarControl]
attribute. Example:min
andmax
currently support the following values:int
,float
,long
andushort
.