This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
644 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
RogueLibsCore/Interactions/VanillaInteractions/SatelliteDish.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_SatelliteDish() | ||
{ | ||
Patch<SatelliteDish>(Params2); | ||
PatchInteract<SatelliteDish>(); | ||
PatchInteractFar<SatelliteDish>(); | ||
|
||
RogueInteractions.CreateProvider<SatelliteDish>(static h => | ||
{ | ||
if (!h.Object.functional) | ||
{ | ||
h.SetStopCallback(static m => m.Agent.SayDialogue("ObjectBroken")); | ||
return; | ||
} | ||
if (h.Helper.interactingFar) | ||
{ | ||
if (!h.Object.adjustedSatellite) | ||
{ | ||
h.AddButton("AdjustSatellite", static m => m.Object.AdjustSatellite(m.Agent)); | ||
} | ||
} | ||
else | ||
{ | ||
h.SetStopCallback(static m => m.Agent.SayDialogue("CantOperateSatelliteDish")); | ||
|
||
if (!h.Object.adjustedSatellite) | ||
{ | ||
InvItem? wrench = h.Agent.inventory.FindItem("Wrench"); | ||
if (wrench is not null) | ||
{ | ||
h.AddButton("UseWrenchToAdjustSatellite", $" ({wrench.invItemCount}) -30", | ||
static m => m.StartOperating("Wrench", 2f, true, "Tampering")); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
RogueLibsCore/Interactions/VanillaInteractions/SecurityCam.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_SecurityCam() | ||
{ | ||
Patch<SecurityCam>(Params2); | ||
PatchInteract<SecurityCam>(); | ||
PatchInteractFar<SecurityCam>(); | ||
|
||
RogueInteractions.CreateProvider<SecurityCam>(static h => | ||
{ | ||
if (h.Helper.interactingFar) | ||
{ | ||
if (h.Object.functional) | ||
{ | ||
h.AddButton("TurnCameraOff", static m => | ||
{ | ||
if (m.gc.serverPlayer) m.Object.MakeNonFunctional(null); | ||
else m.Agent.objectMult.ObjectAction(m.Object.objectNetID, "TurnCameraOff"); | ||
}); | ||
} | ||
else | ||
{ | ||
h.AddButton("TurnCameraOn", static m => | ||
{ | ||
m.Object.MakeFunctional(); | ||
if (!m.gc.serverPlayer) m.Agent.objectMult.ObjectAction(m.Object.objectNetID, "TurnCameraOn"); | ||
}); | ||
} | ||
|
||
h.AddButton("CamerasCaptureOwners", h.Object.targets is "Owners" ? " *" : null, static m => | ||
{ | ||
m.Object.targets = "Owners"; | ||
if (!m.gc.serverPlayer) m.Agent.objectMult.ObjectAction(m.Object.objectNetID, "CamerasCaptureOwners"); | ||
}); | ||
h.AddButton("CamerasCaptureNonOwners", h.Object.targets is "NonOwners" ? " *" : null, static m => | ||
{ | ||
m.Object.targets = "NonOwners"; | ||
if (!m.gc.serverPlayer) m.Agent.objectMult.ObjectAction(m.Object.objectNetID, "CamerasCaptureNonOwners"); | ||
}); | ||
h.AddButton("CamerasCaptureEveryone", h.Object.targets is "Everyone" ? " *" : null, static m => | ||
{ | ||
m.Object.targets = "Everyone"; | ||
if (!m.gc.serverPlayer) m.Agent.objectMult.ObjectAction(m.Object.objectNetID, "CamerasCaptureEveryone"); | ||
}); | ||
} | ||
else | ||
{ | ||
if (!h.Object.functional) | ||
{ | ||
h.SetStopCallback(static m => m.Agent.SayDialogue("ObjectBroken")); | ||
return; | ||
} | ||
if (h.Agent.statusEffects.hasTrait("NoTechSkill")) | ||
{ | ||
h.SetStopCallback(static m => m.Agent.SayDialogue("CantUseTech")); | ||
return; | ||
} | ||
h.AddButton("AttemptTurnOffSecurityCam", $" ({h.Object.FindDisarmPercentage(false)}%)", | ||
static m => m.StartOperating(2f, true, "TurningOffSecurityCam")); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_Sign() | ||
{ | ||
PatchInteract<Sign>(); | ||
|
||
RogueLibs.CreateCustomName("Read", NameTypes.Interface, new CustomNameInfo | ||
{ | ||
English = "Read", | ||
Russian = @"Прочитать", | ||
}); | ||
RogueInteractions.CreateProvider<Sign>(static h => | ||
{ | ||
if (h.Helper.interactingFar) return; | ||
h.AddImplicitButton("Read", static m => | ||
{ | ||
bool quick = m.gc.challenges.Contains("QuickGame"); | ||
string text; | ||
|
||
if (m.Object.isUserCreated && !string.IsNullOrEmpty(m.Object.extraVarString)) | ||
text = m.Object.extraVarString; | ||
else if (!m.gc.serverPlayer && !string.IsNullOrEmpty(m.Object.signTextOnline)) | ||
text = m.Object.signTextOnline; | ||
else if (m.Object.signLocation is 0) | ||
{ | ||
if (m.gc.levelTheme is 5) | ||
text = string.Join("\n\n", | ||
m.gc.nameDB.GetName("Sign_MayorOffice1", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_MayorOffice2", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_MayorOffice3", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_MayorOffice4", NameTypes.Dialogue)); | ||
else if (m.gc.sessionDataBig.curLevelEndless is 1) | ||
text = string.Join("\n\n", | ||
m.gc.nameDB.GetName("Sign_StartGame", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_StartGame2", NameTypes.Dialogue)); | ||
else if (m.gc.sessionDataBig.curLevelEndless is 2) | ||
text = string.Join("\n", | ||
m.gc.nameDB.GetName("Sign_CopRules", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_CopRules2", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_CopRules3", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_CopRules4", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_CopRules5", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_CopRules6", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_CopRules7", NameTypes.Dialogue), | ||
// Note: 8 is supposed to be missing | ||
m.gc.nameDB.GetName("Sign_CopRules9", NameTypes.Dialogue)); | ||
else if (m.gc.sessionDataBig.curLevelEndless == (quick ? 3 : 4)) | ||
text = string.Join("\n\n", | ||
m.gc.nameDB.GetName("Sign_Industrial", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Industrial2", NameTypes.Dialogue)); | ||
else if (m.gc.sessionDataBig.curLevelEndless == (quick ? 5 : 7)) | ||
text = string.Join("\n\n", | ||
m.gc.nameDB.GetName("Sign_Park", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Park2", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Park3", NameTypes.Dialogue)); | ||
else if (m.gc.sessionDataBig.curLevelEndless == (quick ? 7 : 10)) | ||
text = string.Join("\n\n", | ||
m.gc.nameDB.GetName("Sign_Downtown", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Downtown2", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Downtown3", NameTypes.Dialogue)); | ||
else if (m.gc.sessionDataBig.curLevelEndless == (quick ? 9 : 13)) | ||
text = string.Join("\n\n", | ||
m.gc.nameDB.GetName("Sign_Uptown", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Uptown2", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Uptown3", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_Uptown4", NameTypes.Dialogue)); | ||
else text = string.Empty; | ||
} | ||
else if (m.Object.signLocation is 1) | ||
{ | ||
text = m.gc.nameDB.GetName("Sign_FirstElevator", NameTypes.Dialogue); | ||
} | ||
else if (m.Object.signLocation is 2) | ||
{ | ||
text = string.Join("\n\n", | ||
m.gc.nameDB.GetName("Sign_InvestMoney", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_InvestMoney2", NameTypes.Dialogue), | ||
m.gc.nameDB.GetName("Sign_InvestMoney3", NameTypes.Dialogue)); | ||
} | ||
else text = string.Empty; | ||
|
||
m.Object.ShowBigImage(text, string.Empty, null); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
RogueLibsCore/Interactions/VanillaInteractions/SlotMachine.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_SlotMachine() | ||
{ | ||
Patch<SlotMachine>(Params2); | ||
PatchInteract<SlotMachine>(); | ||
PatchInteractFar<SlotMachine>(); | ||
|
||
RogueInteractions.CreateProvider<SlotMachine>(static h => | ||
{ | ||
if (!h.Object.functional) | ||
{ | ||
h.SetStopCallback(static m => m.Agent.SayDialogue("ObjectBroken")); | ||
return; | ||
} | ||
if (h.Helper.interactingFar) | ||
{ | ||
if (h.Object.advantage is 0) | ||
{ | ||
h.AddButton("IncreaseSlotMachineOdds", static m => | ||
{ | ||
m.gc.audioHandler.Play(m.Agent, "Success"); | ||
m.Object.IncreaseSlotMachineOdds(m.Agent); | ||
}); | ||
} | ||
} | ||
else | ||
{ | ||
h.AddButton("Play5", 5, static m => m.Object.Gamble(5)); | ||
h.AddButton("Play20", 20, static m => m.Object.Gamble(20)); | ||
h.AddButton("Play50", 50, static m => m.Object.Gamble(50)); | ||
} | ||
}); | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
RogueLibsCore/Interactions/VanillaInteractions/SwitchBasic.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
|
||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_SwitchBasic() | ||
{ | ||
PatchInteract<SwitchBasic>(); | ||
|
||
// See "Press" in AlarmButton.cs | ||
RogueInteractions.CreateProvider<SwitchBasic>(static h => | ||
{ | ||
if (h.Helper.interactingFar) return; | ||
h.AddImplicitButton("Press", static m => | ||
{ | ||
m.Object.lastHitByAgent = m.Agent; | ||
m.Object.ToggleSwitch(); | ||
m.StopInteraction(); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
RogueLibsCore/Interactions/VanillaInteractions/Television.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Linq; | ||
|
||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_Television() | ||
{ | ||
Patch<Television>(Params1); | ||
PatchInteractFar<Television>(); | ||
MakeInteractable<Television>(); | ||
|
||
RogueInteractions.CreateProvider<Television>(static h => | ||
{ | ||
if (!h.Helper.interactingFar) return; | ||
|
||
if (!h.Object.isHighVolume && h.gc.levelType is not "Tutorial") | ||
{ | ||
h.AddButton("IncreaseVolume", static m => m.Object.IncreaseVolume()); | ||
} | ||
h.AddButton("BlowUpTelevision", static m => | ||
{ | ||
m.Object.BlowUpTelevision(m.Agent); | ||
if (m.gc.levelType == "Tutorial") | ||
{ | ||
m.gc.tutorial.TargetSomething(); | ||
foreach (Computer computer in m.gc.objectRealList.OfType<Computer>()) | ||
computer.openedTutorialDoor = true; | ||
} | ||
m.StopInteraction(); | ||
}); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_Toilet() | ||
{ | ||
Patch<Toilet>(Params2); | ||
PatchInteract<Toilet>(); | ||
|
||
RogueInteractions.CreateProvider<Toilet>(static h => | ||
{ | ||
if (h.Helper.interactingFar) return; | ||
|
||
h.SetStopCallback(static m => m.Agent.SayDialogue("ToiletWontGo")); | ||
|
||
if ((h.Agent.statusEffects.hasTrait("Diminutive") || h.Agent.statusEffects.hasStatusEffect("Shrunk")) | ||
&& !h.Agent.statusEffects.hasStatusEffect("Giant")) | ||
{ | ||
h.AddButton("FlushYourself", static m => m.Object.FlushYourself()); | ||
} | ||
if (h.Object.hasPurgeStatusEffects()) | ||
{ | ||
h.AddButton("PurgeStatusEffects", static m => m.Object.PurgeStatusEffects()); | ||
} | ||
}); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
RogueLibsCore/Interactions/VanillaInteractions/TrapDoor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Net; | ||
|
||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_TrapDoor() | ||
{ | ||
Patch<TrapDoor>(Params1); | ||
PatchInteract<TrapDoor>(); | ||
PatchInteractFar<TrapDoor>(); | ||
MakeInteractable<TrapDoor>(); | ||
|
||
RogueInteractions.CreateProvider<TrapDoor>(static h => | ||
{ | ||
if (!h.Helper.interactingFar) return; | ||
|
||
h.AddButton("OpenTrapDoor", static m => m.Object.OpenTrapDoor(false, false, true)); | ||
}); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
RogueLibsCore/Interactions/VanillaInteractions/TrashCan.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace RogueLibsCore | ||
{ | ||
public static partial class VanillaInteractions | ||
{ | ||
[Include] | ||
private static void Patch_TrashCan() | ||
{ | ||
PatchInteract<TrashCan>(); | ||
|
||
RogueInteractions.CreateProvider<TrashCan>(static h => | ||
{ | ||
if (h.Helper.interactingFar) return; | ||
|
||
h.AddImplicitButton("Open", static m => m.Object.ShowChest()); | ||
}); | ||
} | ||
} | ||
} |
Oops, something went wrong.