You are viewing a potentially older version of this package. View all versions.
QingJinShi-LastWords-0.5.4 icon

LastWords

Players get one chance to publish last words after each death.

Date uploaded 2 weeks ago
Version 0.5.4
Download link QingJinShi-LastWords-0.5.4.zip
Downloads 22
Dependency string QingJinShi-LastWords-0.5.4

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

LastWords / 遗言

《致命公司》(Lethal Company) 的 BepInEx 5 模组。玩家每次死亡后会获得一次发表遗言的机会,复活后次数重置。

当前版本:0.5.4

功能

  • 每帧追踪本地玩家的存活状态,死亡后弹出遗言输入框。
  • 每次死亡只能发送或放弃一次;反复打开界面不会得到额外机会。
  • 只有至少一名其他队员仍然存活时才允许发表遗言;最后一名玩家死亡时不会弹窗,输入期间全员阵亡也会取消发送。
  • 默认 Auto 模式:
    • 飞船已安装且 Signal Translator 可用时,始终调用原版飞船广播;输入可以超过 10 字符,但真正广播的内容只取前 10 个可见字符;
    • 没有设备或设备仍在冷却时,自动使用 LastWords 的可靠命名消息通道发送完整内容,消息格式为 [DECEASED] 玩家名: 遗言。
  • Signal Translator 仍使用游戏原生 RPC,未安装模组的玩家也能看到;LastWords 网络回退要求房间内所有玩家安装同一版本的模组。
  • 网络回退由主机验证死者身份与存活队友,再可靠广播给全员;接收端使用模组自己的置顶 Canvas 显示,不受原版聊天 HUD 限制。
  • 遗言界面采用暗红色“最终通讯”样式,发送与沉默按钮居中对称;接收横幅以红色显示由主机确认的死者姓名和遗言。
  • 发送时会立即把遗言写入发送者本机聊天记录;同时由模组自己的置顶 Canvas 显示 8 秒发送横幅,不再依赖单人全灭后会被隐藏的原版聊天 HUD。
  • 支持中文输入;换行会被压成空格,富文本尖括号会被转义。

Signal Translator 自身有冷却时间。若你希望每条遗言都即时、可靠显示,请在配置中将 BroadcastMode 改成 Chat。

构建

前置条件:

  1. 本机安装《致命公司》。
  2. 安装 BepInEx 5,并至少启动游戏一次。
  3. 安装 .NET SDK 10(项目本身仍输出 netstandard2.1,供 Unity/BepInEx 加载)。

配置并构建:

Copy-Item Config.Build.user.props.template Config.Build.user.props
# 编辑 Config.Build.user.props 中的 GameDirectory
dotnet build LastWords.slnx -c Release

构建结果位于:

src/LastWords/bin/Release/netstandard2.1/LastWords.dll

将 DLL 放进:

<游戏目录>/BepInEx/plugins/LastWords/LastWords.dll

也可以在 Config.Build.user.props 中把 DeployToGame 改为 true,之后每次构建都会自动复制 DLL。

BepInEx 5.4.23.5 / Unity 2022 启动入口

保持 BepInEx 的安全默认入口:

[Preloader.Entrypoint]
Assembly = UnityEngine.CoreModule.dll
Type = Application
Method = .cctor

不要把 Type 改成 MonoBehaviour。该入口会让包括汉化模组在内的所有插件过早初始化;若插件在 Awake 中载入 Unity 贴图,可能导致 UnityPlayer.dll 原生崩溃。LastWords 0.5.2 使用局部的游戏循环补丁解决 v81 不派发早期插件 Update 的问题,不再需要修改全局启动时机。

配置

首次运行后会生成:

BepInEx/config/cn.lastwords.lethalcompany.cfg
  • BroadcastMode = Auto:短消息在真实 Signal Translator 可用时优先使用原版飞船广播,其余使用 LastWords 网络通道(默认)。
  • BroadcastMode = SignalTranslator:只使用真实的飞船广播;允许按 MaximumMessageLength 输入,但实际广播只显示前 10 个字符;必须购买 Signal Translator。
  • BroadcastMode = Chat:始终使用 LastWords 网络消息;所有玩家必须安装模组。
  • MaximumMessageLength = 50:遗言输入的最大长度,安全范围 1–200;Signal Translator 仍只广播前 10 个字符。
  • OpenDelaySeconds = 0.75:死亡到弹窗出现的延迟。
  • AllowWhenAllPlayersDeadForTesting = false:仅用于单人开发测试;设为 true 可临时绕过全灭限制,正式游玩应保持 false。

联机说明

Signal Translator 模式复用游戏原生 HUDManager.UseSignalTranslatorServerRpc。只有飞船实际购买并生成了 Signal Translator 时,未安装 LastWords 的客户端才能接收这条原版广播,并且仍受原版 10 个可见字符限制。没有设备或消息过长时,模组使用 Netcode 命名消息,不创建自定义 NetworkObject,也不需要 Netcode weaver,但所有玩家必须安装相同版本的 LastWords 才能接收回退消息;模组不会自动解锁或伪造 Signal Translator。

“每次死亡一次”的限制在发表者客户端执行,目标是正常联机体验,并非反作弊机制。主机若需要强制校验次数,后续可以增加全员必装的服务端权威网络协议。

作者、版权与转载

LastWords 由 青金石 独立开发。允许玩家下载官方原版用于个人、非商业游玩,也允许制作截图、评测、教程、游戏视频和直播;禁止未经书面许可转载或重新打包 DLL、发布修改版、出售模组、删除署名或冒充作者。

完整条款见 LICENSE.md,真伪与官方发布信息见 NOTICE.md。分享时请优先分享官方发布页链接,不要直接重新上传压缩包。

CHANGELOG

Changelog

0.5.5

  • Adds an English-first bilingual Thunderstore description while retaining complete Simplified Chinese instructions.
  • Adds a clear compatibility table for vanilla clients, Signal Translator broadcasts, fully modded HUD fallback, and full-crew wipes.
  • Separates the player-facing Thunderstore page from source-build documentation and removes developer-only setup details from the public package page.
  • Clarifies installation, configuration, known limitations, troubleshooting, authorship, redistribution rules, and AI-generated icon disclosure.
  • Contains no gameplay behavior changes from 0.5.4.

0.5.4

  • Identifies 青金石 as the public author in the assembly metadata, documentation, and ownership notices.
  • Adds a bilingual proprietary end-user license that permits personal gameplay and attributed media while prohibiting unauthorized redistribution, repackaging, impersonation, derivative releases, and commercial exploitation of the mod itself.
  • Adds an authenticity notice, a recipient-specific HR evaluation-license template, ready-to-copy publication text, and a repeatable release/evidence checklist.
  • Adds guarded release packaging and evidence-archive scripts that generate SHA-256 records and require clean, tagged Git source for final evidence.
  • Adds an original 256x256 Thunderstore icon and validates its PNG format and dimensions during release packaging.
  • Records QingJinShi as the owner-controlled Thunderstore Team and the canonical LastWords package page.
  • Initializes the project for a local Git authorship history without publishing the private source or build artifacts.

0.5.3

  • Allows the last-words input to use the configured maximum length even in SignalTranslator mode.
  • Makes Auto prefer a real, available Signal Translator for messages of any input length, truncating only the actual vanilla broadcast payload to its first 10 visible characters.
  • Shows the sender the exact truncated message and a clear delivery note when the Signal Translator shortened a longer last word.
  • Uses the full message through LastWords networking only when Auto cannot find an available real Signal Translator; vanilla clients still require the purchased device.

0.5.2

  • Restores BepInEx's safe default Application/.cctor entrypoint so plugins that load Unity textures during Awake, including LC Chinese Project 3.2.9, no longer crash inside UnityEngine.ImageConversion.LoadImage.
  • Drives LastWords from narrowly scoped Harmony postfixes on PreInitSceneScript.Start, MenuManager.Update, and HUDManager.Update, instead of changing the startup timing of every installed plugin.
  • Preserves the managed LastWords coordinator when Unity destroys BepInEx's early Chainloader carrier, then creates the Canvas on the first verified live Unity frame.
  • Keeps vanilla-client compatibility limited to a real, purchased Signal Translator and its original 10-character display limit.

0.5.1

  • Centers the transmit and silence buttons symmetrically around the modal's midpoint.
  • Restyles the modal and broadcast banner as a dark blood-red final transmission.
  • Formats authenticated broadcasts as [DECEASED] PlayerName: message and shows received text in red beneath a MESSAGE FROM THE DEAD heading.
  • Bumps the named-message protocol to v2 so mixed 0.5.0/0.5.1 clients cannot misinterpret payloads.

0.5.0

  • Replaces the unreliable vanilla system-chat fallback with a LastWords named-message protocol using reliable sequenced delivery.
  • Requires all players to install the mod for fallback messages; actual Signal Translator broadcasts remain visible to vanilla clients.
  • Validates client submissions on the host, including sender identity, death state, and the presence of another living crew member.
  • Displays received last words through an independent always-on-top Canvas on every modded client.

0.4.6

  • Sends the vanilla crew-wide system-message ClientRpc directly when the last-words sender is the host/server.
  • Avoids the host-to-self ServerRpc round trip that failed to fan out to an unmodded LAN client during a real two-client test.
  • Retains the vanilla ServerRpc relay for non-host senders and logs the active network role and selected route.

0.4.5

  • Suppresses the last-words opportunity when no other connected, living crew member remains.
  • Rechecks the living crew at window-open and submission time, preventing a message after the remaining crew dies while the modal is open.
  • Adds a default-off AllowWhenAllPlayersDeadForTesting configuration override for solo UI development.

0.4.4

  • Adds an independent, always-on-top Canvas banner containing the submitted last words for eight seconds.
  • Keeps the banner visible after the input modal closes, so a solo player's all-dead/spectator HUD cannot hide the local confirmation.
  • Continues sending the same crew-wide vanilla system-message RPC to connected clients.

0.4.3

  • Inserts the crew-wide fallback into the sender's local chat history before sending the global RPC, so a dead host can see their own last words immediately.
  • Shows the submitted text in a 2.25-second local delivery confirmation before closing the last-words window.
  • Relies on vanilla duplicate suppression to prevent the host from seeing the local insertion and RPC echo twice.

0.4.2

  • Replaces the player-chat fallback with vanilla's global system-message RPC (playerId = -1), which is not filtered by sender identity, distance, or alive/dead state.
  • Uses an ASCII [LAST WORDS] prefix because the vanilla HUD font has no Chinese glyphs.
  • Logs why Auto mode selected the crew-wide fallback instead of the Signal Translator.

0.4.1

  • Defers Canvas and dynamic-font creation from plugin Awake to the first real Unity Update frame.
  • Fixes a native UnityPlayer crash caused by calling Font.CreateDynamicFontFromOSFont while Chainloader is still executing inside MonoBehaviour..cctor.

0.4.0

  • Returns to a normal BaseUnityPlugin.Update polling loop after identifying the actual BepInEx bootstrap issue.
  • Documents and applies the MonoBehaviour/.cctor BepInEx entrypoint workaround required when Application/.cctor loads plugins before Unity can register their components for updates.
  • Removes the preloader patcher and all experimental runtime-hook workarounds.

0.3.1

  • Moves the preloader bridge from UnitySynchronizationContext.ExecuteTasks, which is absent from the game's active player loop, to the verified MenuManager.Update and HUDManager.Update methods in Assembly-CSharp.
  • Keeps the same pre-load IL injection architecture while ensuring a tick source exists in both the main menu and an active lobby.

0.3.0

  • Adds a BepInEx preloader patcher that injects the LastWords tick bridge directly into UnitySynchronizationContext.ExecuteTasks before UnityEngine.CoreModule is loaded.
  • Removes runtime-installed Harmony, RuntimeDetour, synchronization-context, and PlayerLoop callbacks after the tested Unity 2022.3 environment consistently replaced or ignored all of them after Chainloader startup.
  • Creates the Canvas lazily when the injected bridge first executes on the live Unity main thread.

0.2.3

  • Inserts the polling callback directly into Unity's native PlayerLoop.Update phase, bypassing MonoBehaviour messages, coroutines, Harmony, and synchronization-context dispatch.
  • Removes the synchronization-context timer fallback after the tested Unity context accepted posted work but never consumed its queue.
  • Retains direct RuntimeDetour hooks for immediate death notification and as an independent polling fallback once the HUD exists.

0.2.2

  • Replaces Harmony patches with direct MonoMod.RuntimeDetour hooks after the tested BepInEx environment recorded Harmony patches without ever entering them.
  • Adds a managed timer that posts polling work to Unity's main-thread synchronization context, providing a hook-independent fallback without touching Unity objects from a background thread.
  • Adds separate diagnostics for the background scheduler, Unity main-thread dispatch, and direct runtime hooks.

0.2.1

  • Drives player-state polling from the game's own HUDManager.Update loop instead of a coroutine on a dynamically-added component.
  • Registers Unity's native Application.onBeforeRender callback as an independent fallback tick source.
  • Adds one-time activation logs for both tick sources, making it possible to distinguish patch failure from player-detection failure.

0.2.0

  • Replaces IMGUI with a persistent screen-space Unity Canvas, legacy InputField, and real Buttons.
  • Replaces scaled-time InvokeRepeating with a WaitForSecondsRealtime coroutine that also runs while the main menu or game is paused.
  • Keeps the Canvas at the highest sorting order so the all-players-dead HUD cannot cover it.
  • Uses a dynamic Microsoft YaHei/Arial font chain so Chinese last words render without relying on Lethal Company's limited bundled fonts.

0.1.3

  • Makes LastWordsRuntime public so Unity reliably dispatches callbacks to the dynamically-added component.
  • Starts state polling explicitly through Unity's native InvokeRepeating scheduler instead of waiting for Update discovery.
  • Logs the component's enabled state and the first scheduled poll.

0.1.2

  • Fixes frame and IMGUI callbacks not being delivered to the BepInEx plugin component in the tested game setup.
  • Creates an explicit active, persistent LastWordsRuntime component for Update and OnGUI.
  • Replaces Harmony assembly scanning with an explicit KillPlayer patch and verifies that the postfix is installed.
  • Adds startup logs for the runtime driver's first Update and OnGUI callbacks.

0.1.1

  • Fixes missed death detection during the single-player all-dead/automatic-return flow.
  • Hooks PlayerControllerB.KillPlayer directly while retaining state polling as a fallback.
  • Forces the IMGUI window to the foreground.
  • Adds diagnostic logs for player tracking, death detection, window opening, first render, and closing.

0.1.0

  • Initial implementation.
  • Detects the local player's alive-to-dead transition without patching a fragile death-method signature.
  • Gives one last-words opportunity per death and resets it after revival.
  • Uses the ship Signal Translator when possible and vanilla chat as an automatic fallback.
  • Adds configurable broadcast mode, message length, and popup delay.