LethalCompanyModding / Enhancer

A small mod designed for solo play
https://thunderstore.io/c/lethal-company/p/Mom_Llama/Lethal_Company_Enhancer/
Other
4 stars 1 forks source link

Customize Game Over Dialogue for Autopilot Early Departure when ScrapProtection is on. #11

Open Yomafil opened 2 months ago

Yomafil commented 2 months ago

Add a feature to change the game over dialogue that appears when the autopilot leaves a planet early because all players have died.

Currently, players have no feedback indicating whether their changes to the ScrapProtection config are functioning as intended other than when they respawn in the ship after the game over animation.

I already made a mod to test the possibility of implementing this feature. Here's a code snippet on how I made it work:

        static int scrapMode = Plugin.CFg.scrapMode;
        //0 = SAVE_NONE, 1 = SAVE_COIN, 2 = SAVE_ALL 

        [HarmonyPatch("gameOverAnimation")]
        [HarmonyPrefix]
        static void GameOverDialogueChange(ref DialogueSegment[] ___gameOverDialogue)
        {
            if (scrapMode == 0)
            {
                Plugin.Log.LogInfo("No text were changed.");
            }
            else if (scrapMode == 1)
            {
                Plugin.Log.LogInfo("Changed text to SAVE_COIN mode.");
                ___gameOverDialogue[1].bodyText = "The autopilot will now attempt to fly to the closest safe spaceport. Some of your items have been lost.";
            }
            else if (scrapMode == 2)
            {
                Plugin.Log.LogInfo("Changed text to SAVE_ALL mode.");
                ___gameOverDialogue[1].bodyText = "The autopilot will now attempt to fly to the closest safe spaceport. None of your items have been lost.";
            }
        }
RobynLlama commented 2 months ago

This is a cool idea and I'd like to implement something like it when I have time