2021-10-15 21:06:51 +01:00
|
|
|
|
using HarmonyLib;
|
2021-12-23 13:29:14 -08:00
|
|
|
|
using QSB.Messaging;
|
2021-10-15 21:06:51 +01:00
|
|
|
|
using QSB.Patches;
|
2021-12-23 13:49:47 -08:00
|
|
|
|
using QSB.Player.Messages;
|
2021-04-18 09:29:12 +01:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
namespace QSB.Player.Patches
|
2021-04-18 09:29:12 +01:00
|
|
|
|
{
|
2022-02-27 04:40:44 -08:00
|
|
|
|
[HarmonyPatch]
|
|
|
|
|
internal class PlayerPatches : QSBPatch
|
2021-04-18 09:29:12 +01:00
|
|
|
|
{
|
2022-02-27 04:40:44 -08:00
|
|
|
|
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
2021-04-18 09:29:12 +01:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
[HarmonyPrefix]
|
|
|
|
|
[HarmonyPatch(typeof(PlayerCrushedController), nameof(PlayerCrushedController.CrushPlayer))]
|
|
|
|
|
public static bool PlayerCrushedController_CrushPlayer()
|
2021-04-18 09:29:12 +01:00
|
|
|
|
{
|
2022-02-27 04:40:44 -08:00
|
|
|
|
// #CrushIt https://www.twitch.tv/videos/846916781?t=00h03m51s
|
|
|
|
|
// this is what you get from me when you mix tiredness and a headache - jokes and references only i will get
|
|
|
|
|
Locator.GetDeathManager().KillPlayer(DeathType.Crushed);
|
|
|
|
|
return false;
|
2021-04-18 09:29:12 +01:00
|
|
|
|
}
|
2021-04-18 19:24:22 +01:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
[HarmonyPrefix]
|
|
|
|
|
[HarmonyPatch(typeof(PlayerData), nameof(PlayerData.LearnLaunchCodes))]
|
|
|
|
|
public static bool LearnLaunchCodes()
|
2021-11-21 13:52:29 +00:00
|
|
|
|
{
|
2022-02-27 04:40:44 -08:00
|
|
|
|
var flag = false;
|
|
|
|
|
if (!PlayerData._currentGameSave.PersistentConditionExists("LAUNCH_CODES_GIVEN"))
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
}
|
2021-11-21 13:52:29 +00:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
else if (PlayerData._currentGameSave.GetPersistentCondition("LAUNCH_CODES_GIVEN"))
|
|
|
|
|
{
|
|
|
|
|
flag = true;
|
|
|
|
|
}
|
2022-02-24 22:04:54 -08:00
|
|
|
|
|
2022-02-27 04:40:44 -08:00
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
|
DialogueConditionManager.SharedInstance.SetConditionState("SCIENTIST_3", true);
|
|
|
|
|
PlayerData._currentGameSave.SetPersistentCondition("LAUNCH_CODES_GIVEN", true);
|
|
|
|
|
GlobalMessenger.FireEvent("LearnLaunchCodes");
|
|
|
|
|
new LaunchCodesMessage().Send();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-04-18 09:29:12 +01:00
|
|
|
|
}
|
2022-02-24 22:04:54 -08:00
|
|
|
|
}
|