Skip to content
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

Missing option to disable/enable weapons in server #118

Open
rzaba0 opened this issue Jul 26, 2022 · 1 comment
Open

Missing option to disable/enable weapons in server #118

rzaba0 opened this issue Jul 26, 2022 · 1 comment

Comments

@rzaba0
Copy link
Contributor

rzaba0 commented Jul 26, 2022

Server can't customize which weapons should be available in game. As of now, all weapons are enabled by default, and the only way to change it requires recompiling the game.

Judging by code, this option was meant to be implemented with cvars, probably with CVAR_SYNC flag:

//TODO: Implement enabled weapons in cvar system
for i := 1 to MAIN_WEAPONS do
WeaponActive[i] := 1;

The UI for this is ready in launcher's weapons-settings branch, but functionality is missing.

@BranDougherty
Copy link
Member

I tested and it's possible via a script like this:

procedure MyGameOnJoin(Player: TActivePlayer; Team: TTeam);
var
  i: Integer;
begin
  // Disable all except deagle and law.
  for i := 2 to 13 do
    Player.WeaponActive[i] := False;
end;

begin
  Game.OnJoin := @MyGameOnJoin;
end.

Also there is the SC2 function SetWeaponActive, and the ForceWeapon scripting options. I think that these cover all the advanced needs of this system. But for the simple use case it would be nice to be able to just set enabled weapons at the command line, so I agree with the TODO.

I think just straight up having 14 cvars is the right way to go here (sv_weaponactive1, sv_weaponactive2...). If more control is really needed, the scripting covers it, so all we should do is set the value in the WeaponActive global, and possibly call NetworkServerFunctions.SetWeaponActive if the game has already been started.

I would like to spend a little more time familiarizing myself with WeaponActive and WeaponSel before implementing this, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants