{"id":13339857,"url":"https://github.com/NSHoffman/N7CommandManager","last_synced_at":"2025-03-11T15:31:33.939Z","repository":{"id":159296526,"uuid":"525900585","full_name":"NSHoffman/N7CommandManager","owner":"NSHoffman","description":"Flexible Command Manager for Killing Floor Three Hundred Pounds server. Provides rich API to change various game settings and trigger different events.","archived":false,"fork":false,"pushed_at":"2024-04-26T08:38:18.000Z","size":149,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2024-10-24T02:34:36.572Z","etag":null,"topics":["config","game","greylisted","killingfloor","mutator","unrealscript"],"latest_commit_sha":null,"homepage":"","language":"UnrealScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NSHoffman.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-17T17:56:35.000Z","updated_at":"2024-04-26T08:38:22.000Z","dependencies_parsed_at":"2024-10-23T23:04:10.986Z","dependency_job_id":"8c1972de-f7d9-4548-967f-680771ffc499","html_url":"https://github.com/NSHoffman/N7CommandManager","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSHoffman%2FN7CommandManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSHoffman%2FN7CommandManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSHoffman%2FN7CommandManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NSHoffman%2FN7CommandManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NSHoffman","download_url":"https://codeload.github.com/NSHoffman/N7CommandManager/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243059630,"owners_count":20229611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","game","greylisted","killingfloor","mutator","unrealscript"],"created_at":"2024-07-29T19:21:19.419Z","updated_at":"2025-03-11T15:31:33.559Z","avatar_url":"https://github.com/NSHoffman.png","language":"UnrealScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# N7 Command Manager\n\n## Description\n\nKilling Floor Mutate API initially designed and developed for Three Hundred Pounds server.\nProvides various commands for both players and admins to change game settings and trigger gameplay actions/events.\n\n## Table of Contents\n\n- [1. Motivation](#motivation)\n- [2. What N7CM is offering](#what-n7cm-is-offering)\n- [3. How to use](#how-to-use)\n  - [3.1. Regular Players](#regular-players)\n  - [3.2. Admins](#admins)\n  - [3.3. Developers/Modders](#developersmodders)\n    - [3.3.1. `N7_CommandManager`](#n7_commandmanager)\n    - [3.3.2. `N7_GameStateUtils`](#n7_gamestateutils)\n    - [3.3.3. `N7_CommandValidator`](#n7_commandvalidator)\n    - [3.3.4. `N7_CommandExecutionState`](#n7_commandexecutionstate)\n    - [3.3.5. `N7_Command`](#n7_command)\n    - [3.3.6. Command Classes (`N7_GameSettingsCommand`, `N7_TargetCommand` etc)](#command-classes-n7_gamesettingscommand-n7_targetcommand-etc)\n    - [3.3.7. Models (`N7_HPConfigModel`, `N7_FakedPlayersModel` etc)](#models-n7_hpconfigmodel-n7_fakedplayersmodel-etc)\n    - [3.3.8. `N7_ColorManager`/`N7_CommandMessageColors`](#n7_colormanagern7_commandmessagecolors)\n- [4. Changelog](#changelog)\n- [5. Contacts](#contacts)\n\n## Motivation\n\nThe motivation and reasoning behind development of the command manager is that most publicly available APIs have:\n\n- Limited availability for certain actor groups (i.e. AdminPlus is admin-only API)\n- Little potential for further extension (Adding new commands when needed, editing the existing ones)\n- Poor configuration capabilities\n- Inconsistent and not thorough validation mechanism\n\n## What N7CM is offering\n\n- Large number of built-in commands\n- Ability to provide multiple aliases for a single command (so it can be called in the way you are used to)\n- Access configuration (Players/Spectators/Admins)\n- MinMax values configuration for numeric arguments\n- Rich and consistent validation for sender, targets, arguments, game state etc.\n- Structure flexible enough to allow for API extension when new commands are needed\n- Three-level notification system (for senders, for targets and global)\n- Color highlighting configuration capabilities for certain parts of notifications/messages\n\n## How to use\n\n### Regular Players\n\nRegular players can use any non-admin command from this pack.\nThe common signature is: `mutate [command] [...args]`.\nThe list of available commands for players can be requested via `mutate help`.\nTo get information or (if available) some extended details regarding specific command one can use `mutate help [command]`.\n\n### Admins\n\nAdmins can use all of the regular commands + bunch of commands with admin-only access\nThe list of available commands for admins can be requested via `mutate ahelp` or `mutate adminhelp` (check `N7_AdminHelpCommand` aliases).\nTo get information or (if available) some extended details regarding specific admin command one can use `mutate ahelp [command]`.\n\n\u003e [`CONFIG.md`](./CONFIG.md) contains basic guidelines for command settings configuration\n\n### Developers/Modders\n\nFor those who want to extend the existing API there is some more information in terms of internal structure of the command manager.\n\n#### `N7_CommandManager`\n\nThis is the entry file, the mutator itself that dispatches incoming `mutate` requests.\nEach of the available commands' classes must be specified in `N7_CommandManager.CommandsClasses` array.\nInitialization includes the following steps:\n\n- `InitServices()` - Initialization of the services used by the command manager and individual command classes;\n- `InitModels()` - Initialization of data related to specific game settings that need to be kept track of;\n- `InitCommands()` - Initialization of commands. Command classes from `N7_CommandManager.CommandsClasses` get initialized and stored in `N7_CommandManager.Commands` array. Both arrays are static and one need to pay attention to capacity of those which is defined by `COMMANDS_COUNT` constant.\n\n#### `N7_GameStateUtils`\n\nThis file contains some useful methods that can be applied in variety of commands and take significant number of code lines.\nMostly these would affect some parts of ZEDs, players or game state.\n\nEach command has access to `N7_GameStateUtils` via `GSU` field which is defined in `N7_CommandManager` file.\n\n#### `N7_CommandValidator`\n\nThis class provides validation API that is used to check user input and various aspects of game state.\n\n#### `N7_CommandExecutionState`\n\nThese classes keep track of command state when its execution is in progress.\n\n`N7_CommandExecutionState` contains information about current execution, namely:\n\n- The Sender\n- Targets (if there are any)\n- Status and Error Code (if status is failed)\n- Command Arguments\n\nIt also allows for caching of some temporary values that are needed across different execution stages but need not be recalculated.\nIt can cache:\n\n- String\n- TargetName\n- Integer\n- Float\n- Boolean\n\n#### `N7_Command`\n\nBase class for all commands. Each new command must be derived from this class to inherit the base execution flow.\nThe execution flow consists of 5 stages:\n\n1. `N7_CommandExecutionState` Initialization - Execution State literally gets its initial values.\n2. Arguments validation - Multi-step validation process when lots of conditions get checked (Gametype, Sender, Game State, Admin Access Restrictions etc.)\n3. Action Processing - Desired effects/actions are applied.\n4. Success/Error Notification - Depending on notification settings a selection of actors are notified about execution status.\n5. Optional Cleanup - If any values not related to `N7_CommandExecutionState` were used to keep track of execution progress those need to be reset.\n\nThis flow is `final` and cannot be altered in subclasses.\nUsually one might want to override the following methods to alter the command execution:\n\n- `Check...(N7_CommandExecutionState)` - Checker methods.\n- `DoAction(N7_CommandExecutionState)` - This is where the actual action logic resides.\n- `Notify...(N7_CommandExecutionState)` - Notifications.\n\n#### Command Classes (`N7_GameSettingsCommand`, `N7_TargetCommand` etc)\n\nClasses derived from `N7_Command` which provide common logic for specified sets of commands.\n\n`N7_GameSettingsCommand` provides some configuration and settings for commands whose sole purpose is to change\nsome game settings be it maximum players number or ZED-time status.\n\n`N7_TargetCommand` provides extended logic for commands that affect a selection of players.\nHere resides the common logic for target validation and per-target command execution.\n\n#### Models (`N7_HPConfigModel`, `N7_FakedPlayersModel` etc)\n\nModels' only purpose is exposing some of the game-/command-related APIs to `N7_CommandManager`\nso it does not get overwhelmed with data management functionality.\n\n#### `N7_ColorManager`/`N7_CommandMessageColors`\n\nThese classes are responsible for coloring of messages and notifications.\n\n`N7_ColorManager` is the class that provides color collection based on [Material Design colors](https://materialui.co/colors/).\nIt also provides API for text coloring and color picking based on IDs rather than RGBA structs.\nAll color IDs follow the same structure: `\u003ccolor\u003e:\u003ctint\u003e`. Also `black`, `white` or `rgb(byte, byte, byte)` compliant values are supported.\nInformation on both colors and tints can be found on Material Design colors page.\n\n`N7_CommandMessageColors` is just a class that keeps configurable color IDs for various messages/notifications parts.\nIt is also responsible for providing colorization API for commands.\nOne is not strictly tied to the cases defined in base `N7_CommandMessageColors` class as it can be extended and assigned to `N7_CommandManager.ColorsClass` field.\n\n## Changelog\n\nAll the changes and updates can be found in the separate [`CHANGELOG.md`](./CHANGELOG.md) file.\n\n## Contacts\n\nFor questions/concerns/recommendations you can contact me via steam or email:\n\n**Steam Profile:** [N7n](https://steamcommunity.com/id/NSHoffman/)\n\n**Email:** [hoffmanmyst@gmail.com](mailto:hoffmanmyst@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNSHoffman%2FN7CommandManager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNSHoffman%2FN7CommandManager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNSHoffman%2FN7CommandManager/lists"}