Начните вводить название — например, MoreHead, Sodium или PEAK

LethalAPI Terminal — иконка
Обложка Lethal CompanyМод для Lethal Company

LethalAPI Terminal

от LethalAPI

Полноценный API моддинга для всего, что связано с терминалом на борту. Включая пользовательские команды, взаимодействия, капитальные ремонты терминалов, условные переопределения команд и многое другое.

  • Обычный
  • 364 тыс. скачиваний
  • Версия 1.0.1
  • Обновлён 9 января 2024
  • Не обновлялся больше года
  • Библиотека

О моде LethalAPI Terminal

LethalAPI Terminal — мод для Lethal Company (Летал Компани) от автора LethalAPI. Полноценный API моддинга для всего, что связано с терминалом на борту. Включая пользовательские команды, взаимодействия, капитальные ремонты терминалов, условные переопределения команд и многое другое.

Его скачали 364 тыс. раз: это 453-е место среди модов Lethal Company в нашем каталоге, редкость — «обычный» (нижняя половина по скачиваниям). Мод давно не обновлялся — проверьте совместимость с текущей версией игры, актуальная версия — 1.0.1.

Для работы ему нужны: BepInExPack.

Полное описание LethalAPI Terminal

Текст автора на языке оригинала

LethalAPI.Terminal

Terminal Commands API for the Lethal Company Modding API

Misc Changes

This mod makes some changes to how the terminal works, that isn't fully integral to custom commands.

These changes are as such:

  • Reduces the delay after entering the terminal before you can type by 80%
  • You ever open the terminal and start typing, even hearing the keyboard sound, but it doesn't write anything? This fixes that.
  • Disable scrolling to the top of the terminal on every command execution
  • This now only happens when a command clears the screen.
  • Trims newlines from the start of command responses
  • The game force adds newlines to the start of commands, which causes issues for commands that don't clear the terminal.

Creating terminal commands

Terminal commands are declared as annotated methods. E.g.,

[TerminalCommand("Ping"), CommandInfo("Test command")]
public string PingCommand()
{
    return "Pong!";
}

All terminal commands are annotated with the TerminalCommand Attribute, and optionally, the CommandInfo Attribute.

The CommandInfo attribute attaches command metadata and enrolls the command to be displayed in the help command.

You can also attach access control attributes, e.g., AllowedCaller to specify who can execute a command and when. More on this later.

Registering Commands

All commands have to be registered to this library. Registering commands can be done through the CommandRegistry API. E.g.,

private TerminalModRegistry Commands;

public void Awake()
{
  Commands = TerminalRegistry.CreateModRegistry();
  Commands.RegisterFrom(this); // Register commands from the plugin class
  Commands.RegisterFrom(AnotherObject); // Register commands from another instance
  Commands.RegisterFrom(); // Activate and register commands from a type
}

You can also deregister commands by calling TerminalModRegistry.Deregister().

Handling arguments

All arguments are injected into the method, either parsed from the user input, or sourced from the execution context. E.g.,


[TerminalCommand("RickRoll")]
public string RickRollCommand(Terminal caller, [RemainingText] string text)
{
  // Echoes the user's message back to them, and rickrolls them
  caller.PlayVideoFile(RickrollVideoPath);
  return text;
}

[TerminalCommand("Multiply")]
public int MultiplyCommand(int a, int b)
{
  return a * b;
}

Notice how commands don't need to return a string but can return anything. You can return your own TerminalNode, which is how the game itself handles command responses, or you can return anything, and it will be converted to a string.

Additionally, if you return null, execution will fall through to the next valid command handler. More on this later.

You can even parse some extra types such as PlayerControllerB, which will be parsed from Steam64ID, or player name. Argument injection is a useful tool to reduce boilerplate and create command overloads.

You can inject as many arguments as you want, and the method will only be executed when all specified arguments can be provided, either from context, or parsed from user input. Generally, you will never need to manually parse basic arguments yourself. However, if you do want to handle argument parsing yourself, you can inject either string[] or ArgumentStream.

Command Overloading

When a player runs a command, the first step in this process is selecting candidate commands. All commands registered with the same command name, and matching signatures can be evaluated. These commands with matching/compatible signatures will be executed in descending order of priority, and then argument count.

So a command with more arguments will take priority over a command with less arguments. However all these arguments still must be valid and parsed from user input. Meaning you can create command patterns such as:


[TerminalCommand("BuyArtefact")]
public string BuyArtefactCommand()
{
  return $"Available Artefacts:\n"
    + FormatAvailableArtefacts();
}

[TerminalCommand("BuyArtefact")]
public string BuyArtefactCommand(string artefactName)
{
  if(TryBuyArtefact(artefactName))
    return "Artefact purchased!";

  return "Insufficient funds";
}

Here, running BuyArtefact will execute the first handler, but running BuyArtefact gun will execute the second. This is because the 2nd one has more arguments, so it will take priority when the user's input matches the commands signature.

Additionally, the 2nd command could yield execution to the first, by returning null. Since commands are executed in order, if one command returns null, command handling will be passed ot the next handler.

This means you can conditionally override other commands, including commands built-in to the game. To aide with this, you can also set the command priority using the CommandPriority attribute, to make it execute before another command regardless of argument count.

Access Control

You can also decorate commands with the AllowedCaller attribute, to set what players can execute it, e.g., host-only. For commands registered to be shown in the help command results, commands that a player doesn't have access to won't be shown. E.g.,

[TerminalCommand("Kill")]
public string KillPlayerCommand()
{
  return "Usage: Kill [Player]\n" +
    "You must be the host to use this command";
}

[TerminalCommand("Kill"), AllowedCaller(AllowedCaller.Host)]
[CommandInfo("Kills the target player", "[Player]")]
public string KillPlayerCommand(PlayerControllerB player)
{
  if (StartOfRound.Instance == null)
    return "Game not started";

  player.KillPlayer(Vector3.up);
  return $"Killed {player.playerUsername}";
}

The first command can be executed by anyone, but still won't show in the help command, since it doesn't have the CommandInfo at

Описание длинное — здесь его начало. Читать целиком на странице автора

Нужно для работы

В r2modman ставится автоматически

Как установить LethalAPI Terminal

Файл скачивается с официального сервера Thunderstore, без перезаливов и сторонних установщиков

Подробная инструкция для Lethal Company
  1. Скачайте менеджер модов r2modman (или Gale) и выберите в нём игру Lethal Company.
  2. Создайте профиль — так моды не смешаются с чистой версией игры.
  3. Найдите «LethalAPI Terminal» во вкладке Online и нажмите Download — BepInEx и все зависимости подтянутся сами.
  4. Нажмите «Start modded» — игра запустится с модами.
  5. Для мультиплеера всем игрокам нужен одинаковый набор модов: в r2modman профиль можно экспортировать кодом и отправить друзьям.
Вы автор мода? Поставьте ссылку на русское описание

Вставьте значок в описание на Thunderstore, в README или в Discord — русскоязычные игроки сразу попадут на страницу с переводом и инструкцией.

Описание на русском — Модка
Markdown[![Описание на русском — Модка](https://modka.app/badge.png)](https://modka.app/lethal-company/lethalapi-lethalapi-terminal/)
HTML<a href="https://modka.app/lethal-company/lethalapi-lethalapi-terminal/"><img src="https://modka.app/badge.png" alt="Описание на русском — Модка" height="44"></a>
Steam (BBCode)[url=https://modka.app/lethal-company/lethalapi-lethalapi-terminal/]Описание на русском — Модка[/url]

Частые вопросы о LethalAPI Terminal

Как установить LethalAPI Terminal?

Скачайте менеджер модов r2modman (или Gale) и выберите в нём игру Lethal Company. Создайте профиль — так моды не смешаются с чистой версией игры. Найдите «LethalAPI Terminal» во вкладке Online и нажмите Download — BepInEx и все зависимости подтянутся сами. Нажмите «Start modded» — игра запустится с модами. Для мультиплеера всем игрокам нужен одинаковый набор модов: в r2modman профиль можно экспортировать кодом и отправить друзьям.

Безопасен ли LethalAPI Terminal?

Файл скачивается с официального сервера Thunderstore, куда его загрузил LethalAPI. Мы не перезаливаем и не изменяем моды.

Нужно ли друзьям ставить LethalAPI Terminal?

Автор не указал, клиентский это мод или серверный. Безопаснее, чтобы одинаковый набор модов был у всех игроков в лобби: проще всего поделиться профилем r2modman.

Что нужно для работы LethalAPI Terminal?

Установите вместе с ним: BepInExPack. В менеджере модов зависимости подтягиваются автоматически.

Когда LethalAPI Terminal обновлялся последний раз?

9 января 2024, актуальная версия — 1.0.1. Это больше года назад: перед установкой проверьте, работает ли мод на текущей версии игры.

ReservedFlashlightSlot — иконка

ReservedFlashlightSlot

Отдельный слот для фонарика справа на экране, который при желании можно купить. Клавишей [F] фонарик включается в любой момент.

Легендарный16,3 млнСнаряжение

Mimics — иконка

Mimics

Добавляет в игру опасного нового монстра. Сможете ли вы отличить настоящее от подделки или станете его добычей?

Легендарный14,4 млнМонстры

ReservedWalkieSlot — иконка

ReservedWalkieSlot

Отдельный слот для рации справа на экране, который при желании можно купить. Клавишей [X] можно в любой момент включить рацию и говорить в неё.

Легендарный12,4 млнСнаряжение

Lategame Upgrades — иконка

Lategame Upgrades

Мод с множеством улучшений, которые покупаются в терминале через интерактивное приложение. Почти все улучшения можно настроить под свой вкус.

Легендарный10,7 млнBepInEx

YippeeMod — иконка

YippeeMod

Заменяет стрекот Hoarding Bug на звук yippee-tbh.

Легендарный9,1 млнBepInEx

Coroner — иконка

Coroner

Добавляет причину смерти в отчёт об эффективности, теперь ещё и с API для модов.

Легендарный7,3 млнTweaks & Quality Of Life