-
Notifications
You must be signed in to change notification settings - Fork 13
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
Allow server operators to exempt some weapons from weapon stay #278
base: master
Are you sure you want to change the base?
Conversation
Nitpick. But I think Edit: I have looked at the code and all I can say is (beside a C style array I did see) I am not sure whether your code is the right way but I really do not like the way you have done it. Really like to know what rafalh thinsk. |
{&WeaponStayExemptionConfig::rail_gun, 0x00872124}}; | ||
|
||
// declare optional vector for weapon stay exemptions | ||
std::optional<std::vector<uintptr_t>> weapon_stay_exempt_indexes; |
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.
what's the point of making it an optional? Empty vector would have the same effect
@@ -197,12 +243,83 @@ void load_additional_server_config(rf::Parser& parser) | |||
} | |||
} | |||
|
|||
// memory addresses for weapon stay exemption indexes | |||
constexpr std::pair<bool WeaponStayExemptionConfig::*, uintptr_t> weapon_exemptions[] = { | |||
{&WeaponStayExemptionConfig::rocket_launcher, 0x00872458}, |
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 really no need to have all those offsets hardcoded here. Just let the people configure list of class names, then at load time translate them to indices using weapon_lookup_type
@@ -96,6 +96,52 @@ void load_additional_server_config(rf::Parser& parser) | |||
} | |||
} | |||
|
|||
if (parser.parse_optional("$DF Weapon Stay Exemptions:")) { |
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.
Nitpick. But I think exclude or exclusions is better.
I don't like "exemptions" too. I think it's not a popular word. Excludes/exclusions sounds more familiar.
Anyway it would make sense to include Fusion Launcher on that list by default and allow changing it to an empty list or whatever the server owner wants. Like if we are making it configurable, there is no reason to have Fusion as a special case.
PR adds the
$DF Weapon Stay Exemptions
dedicated server config option, and resolves #65This is something that has been asked for a lot by players over the past few years, particularly for the Rail Driver. The ability to treat the Rail Driver as a superweapon like the fusion, which is exempt from weapon stay by default, in theory might actually make the Rail Driver practical in a competitive setting.
I considered implementing this as simply a
$DF Rail Driver Is Superweapon
toggle, but given how relatively straightforward it was to also support the other weapons, I erred on the side of providing more (completely optional) gameplay customization opportunities to server operators, and expanded the capability to the other weapons.