Skip to content

Commit

Permalink
[OA] Upgrade to Our Apartment v0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sauceke committed Jun 24, 2024
1 parent 2e17a3d commit b7ffd4a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 61 deletions.
11 changes: 6 additions & 5 deletions src/LoveMachine.OA/LoveMachine.OA.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputPath>..\bin\LoveMachine.OA\BepInEx\plugins\OA_LoveMachine\</OutputPath>
<RuntimeIdentifier>none</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LoveMachine.Core\LoveMachine.Core.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="UnityEngine.Core" Version="5.6.0" ExcludeAssets="runtime" />
<ProjectReference Include="..\LoveMachine.Core.IL2CPP\LoveMachine.Core.IL2CPP.csproj"/>
</ItemGroup>
</Project>
104 changes: 54 additions & 50 deletions src/LoveMachine.OA/OurApartmentGame.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,80 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using HarmonyLib;
using LoveMachine.Core.Game;
using LoveMachine.Core.Common;
using LoveMachine.Core.Game;
using UnityEngine;

namespace LoveMachine.OA
namespace LoveMachine.OA;

internal sealed class OurApartmentGame : GameAdapter
{
internal sealed class OurApartmentGame : GameAdapter
{
private static readonly string[] layerNames =
{ "Base SexSim", "From Behind SexSim", "Couch Missionary SexSim" };
private static readonly string[] layerNames =
{ "Base SexSim", "From Behind SexSim", "Couch Missionary SexSim" };

private Traverse<bool> isSex;
private Animator naomiAnimator;
private IEnumerable<int> animationLayers;
private Traverse<bool> isSex;
private Animator naomiAnimator;
private IEnumerable<int> animationLayers;

protected override Dictionary<Bone, string> FemaleBoneNames => new Dictionary<Bone, string>
{
{ Bone.Vagina, "cc_pussy_clit" },
{ Bone.LeftBreast, "cc_boob.l" },
{ Bone.RightBreast, "cc_boob.r" },
{ Bone.Mouth, "c_teeth_top.x" },
{ Bone.LeftFoot, "c_toes_thumb1.l" },
{ Bone.RightFoot, "c_toes_thumb1.r" },
{ Bone.LeftHand, "index1.l" },
{ Bone.RightHand, "index1.r" }
};
protected override Dictionary<Bone, string> FemaleBoneNames => new Dictionary<Bone, string>
{
{ Bone.Vagina, "cc_pussy_clit" },
{ Bone.LeftBreast, "cc_boob.l" },
{ Bone.RightBreast, "cc_boob.r" },
{ Bone.Mouth, "c_teeth_top.x" },
{ Bone.LeftFoot, "c_toes_thumb1.l" },
{ Bone.RightFoot, "c_toes_thumb1.r" },
{ Bone.LeftHand, "index1.l" },
{ Bone.RightHand, "index1.r" }
};

protected override int HeroineCount => 1; // Just Naomi
protected override int HeroineCount => 1; // Just Naomi

protected override int MaxHeroineCount => 1;
protected override int MaxHeroineCount => 1;

protected override bool IsHardSex => GetPose(0).Contains("Pump2");
protected override bool IsHardSex => GetPose(0).Contains("Pump2");

protected override int AnimationLayer => animationLayers
.Where(i => naomiAnimator.GetLayerWeight(i) == 1f)
.DefaultIfEmpty(-1)
.First();
protected override int AnimationLayer => animationLayers
.Where(i => naomiAnimator.GetLayerWeight(i) == 1f)
.DefaultIfEmpty(-1)
.First();

protected override float PenisSize => 0.2f;
protected override float PenisSize => 0.2f;

protected override MethodInfo[] StartHMethods =>
new[] { AccessTools.Method("SexSimControl, Assembly-CSharp:InitializeAsync") };
protected override MethodInfo[] StartHMethods => new[]
{
AccessTools.Method("Momoirosoft.Managers.SexSimControl, Assembly-CSharp:InitializeAsync")
};

protected override MethodInfo[] EndHMethods =>
new[] { AccessTools.Method("SexSimControl, Assembly-CSharp:RunSexConclusion") };
protected override MethodInfo[] EndHMethods => new[]
{
AccessTools.Method("Momoirosoft.Managers.SexSimControl, Assembly-CSharp:RunSexConclusion")
};

protected override Animator GetFemaleAnimator(int girlIndex) => naomiAnimator;
protected override Animator GetFemaleAnimator(int girlIndex) => naomiAnimator;

protected override GameObject GetFemaleRoot(int girlIndex) => null;
protected override GameObject GetFemaleRoot(int girlIndex) => null;

protected override Transform PenisBase =>
GameObject.Find("cc_balls1.l")?.transform ?? transform;
protected override Transform PenisBase =>
GameObject.Find("cc_balls1.l")?.transform ?? transform;

protected override string GetPose(int girlIndex) =>
naomiAnimator.GetCurrentAnimatorClipInfo(AnimationLayer).FirstOrDefault().clip?.name
?? "unknown_pose";
protected override string GetPose(int girlIndex) =>
naomiAnimator.GetCurrentAnimatorClipInfo(AnimationLayer).FirstOrDefault().clip?.name
?? "unknown_pose";

protected override bool IsIdle(int girlIndex) => !isSex.Value;
protected override bool IsIdle(int girlIndex) => !isSex.Value;

protected override bool IsOrgasming(int girlIndex) => GetPose(0).Contains("Cum");

protected override IEnumerator UntilReady(object sexSimControl)
protected override bool IsOrgasming(int girlIndex) => GetPose(0).Contains("Cum");

protected override IEnumerator UntilReady(object sexSimControl)
{
while (naomiAnimator == null)
{
yield return new WaitWhile(() =>
(naomiAnimator = GameObject.Find("NaomiRig").GetComponent<Animator>()) == null);
isSex = Traverse.Create(sexSimControl).Field<bool>("_sexActive");
animationLayers = Enumerable.Range(0, naomiAnimator.layerCount)
.Where(i => layerNames.Contains(naomiAnimator.GetLayerName(i)));
yield return new WaitForSeconds(1f);
naomiAnimator = GameObject.Find("NaomiRig")?.GetComponent<Animator>();
}
isSex = Traverse.Create(sexSimControl).Property<bool>("_sexActive");
animationLayers = Enumerable.Range(0, naomiAnimator.layerCount)
.Where(i => layerNames.Contains(naomiAnimator.GetLayerName(i)));
}
}
11 changes: 5 additions & 6 deletions src/LoveMachine.OA/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
using LoveMachine.Core;
using LoveMachine.Core.NonPortable;

namespace LoveMachine.OA
{
[BepInPlugin(Globals.GUID, Globals.PluginName, Globals.Version)]
internal class Plugin : LoveMachinePlugin<OurApartmentGame>
{ }
}
namespace LoveMachine.OA;

[BepInPlugin(Globals.GUID, Globals.PluginName, Globals.Version)]
internal class Plugin : LoveMachinePlugin<OurApartmentGame>
{ }
Binary file modified src/LoveMachine.OA/PluginInfo.ini
Binary file not shown.

0 comments on commit b7ffd4a

Please sign in to comment.