Best way to handle instance-specific configurations

hello, so i’m wondering what approach i’m meant to be taking towards having organized and optimized code.

i’m wondering, for example; how i can handle custom player states such as sprinting, crouching., crawling, etc. while keeping it easy to add more with different stats, but also keeping the scripts organized,

i started off with a handler and i got the basic functions down, im just not sure if im doing this correctly. i’m using a module to connect and disconnect players using a function similar to subscribing them to a service, then i update all of the states, while taking in external function activations to apply states, etc. independently if it’s triggered through key press, such as actions like prone or crouch or sprint.

configs were too complicated for the states because they required a lot of item specific variables like the idle or prone animations, which couldn’t be simply expressed through generic variables applied to all states.

for example; the idle animation needed a specific variable which said that the state acted like an idle state, which was in every config, another example is the prone, i wanted it to be the same key as crouch but then i needed an extra two settings so that would work, making the configuration unreadable

so, what i did was just internally store and apply the data inside the handler.

(this problem also occurs with making gun systems, for example, some weapons have alternative fire modes such as under barrel grenade launchers, but others don’t and using a configuration type system is difficult and really complex when you start adding all of the “oh what if they want to do this?” later on when you’re working on other guns , and you have to add the variable set to EVERY config you already made.)

is this okay? is there any better methods of doing this? any and all help is appreciated.

certain games like HELLMET or dummies vs noobs (games by @Sensei_Developer) have weapons with specific abilities that are only inherent to that specific gun. handling this seems like a nightmare, and advice on the best approach would be greatly appreciated.