FindItemsForQuota

版本 v1.2.3·更新於 2024-04-07

Finds the items to min-max the quota and tps them in front of the company shelf.

模組介紹 作者原文

FindItemsForQuota

A mod that finds the items that sum as close as possible to quota (a.k.a "min-maxing") and teleports them in front of where they need to be sold.

Usage

To use this mod, you need to be at the company, wait for the ship to be landed (wait until the lever stops saying "[wait for ship to land]"), and then type one of the following commands into the in-game chat:

".find moon" where "moon" is either rend or art

".find target".find rend will find the amount of money needed to either hit quota or go to rend (have 550),.find art does something similar, and.find target will find the amount of money you need to have an extra target amount of money after overtime has been calculated.

For example, say I wanted to buy a jetpack, and I currently have $200 saved up. Since jetpacks cost $500, I would then run /find 500, and it would find the items so that you have $700 after the overtime bonus.

Issues

I've recently discovered that if there are too many items on ship (> 250) then a wide number of desyncs happen, including shotguns having the safety on/off for different people, and for this mod in particular, the value of scrap on ship showing up as lower for people who are not host. This in particular means that the mod will grab too many items because it does not have the correct value of scrap on the ship. In particular, this means that

If you are not host, do not use this mod if there are > 250 items on ship.

Since this host cannot desync from themselves, this mod has no issues when you are the host. Of course, if there are <=250 items, then any person (not just the host) can use this mod freely, without any problems.

Installation

  • Install BepInEx
  • Find the location of your game by clicking on the gear and selecting Manage then browse local files
  • Extract the mod to BepInEx/plugins

Or let handle it.

References

A lot of the code for this mod has been inspried by ShipLoot. This project would not have been completed without the help of it's source code.

For anyone interested, the problem this mod has to solve is something called the subset-sum problem, defined as follows:

Given a list of numbers $a_0, \ldots, a_n$, and a target $T$, return a sublist of the numbers $a_{k_0}, \ldots, a_{k_m}$ with

$$\sum_{i=0}^{m} a_{k_i} = T.$$

In the context of lethal company the $T$ is the quota and then $a_i$ are the scrap value of items on ship.

In complexity theory, there are two complexity classes that the entire world is thinking about: P and NP. P, short for polynomial, is the class of algorithms that can be solved in polynomial (i.e., efficient) time. NP stands for non-deterministic polynomial, meaning algorithms that can be verified (i.e., given the output of the algorithm, you can check it's correctness) in polynomial time. The hardest and most important problem from theoretical computer science is the question of whether or not P = NP. It is widely believed that P $\neq$ NP, but no one has been able to prove that so far (and if someone could, they would win every award in computer science, and $1,000,000!). There is a class of problems called NP-hard, which, if ANY of them were also in P, then P = NP. In particular, subset-sum (or more generally the knapsack problem) is NP-hard. NP-hard also means that the most efficient algorithm would take $10^{37}$ years to complete on an input size of size 100, which is an obvious problem since in lethal company you can have upwards of 300 items on ship.

The only thing one can do in these sort of situations is look for good approximation algorithms, that use randomness to approximate the result with high probability. The paper I found detailing such an algorithm was Przydatek99, which gives a shockingly low relative error bound with extremely high probability. This project would also not have been completed without the incredible results of this paper, bringing the time the algorithm runs down from $10^{37}$ years to more like $0.5$ seconds.

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack

檔案與校驗

檔案名稱
FindItemsForQuota-1.2.3.zip
檔案大小
81.9 KiB