Skip to content

Commit

Permalink
[HC] Find characters the proper way
Browse files Browse the repository at this point in the history
  • Loading branch information
Sauceke committed Dec 29, 2024
1 parent 708fe2e commit 2b8115e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
25 changes: 14 additions & 11 deletions src/LoveMachine.HC.DigitalCraft/DigitalCraftGame.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections;
using System.Reflection;
using HarmonyLib;
using Il2CppInterop.Runtime;
using LoveMachine.Core.Common;
using LoveMachine.Core.Game;
using UnityEngine;
Expand Down Expand Up @@ -37,7 +38,7 @@ public class DigitalCraftGame : GameAdapter
protected override float PenisSize => 0.07f;
protected override int AnimationLayer => 0;
protected override int HeroineCount => females.Length;
protected override int MaxHeroineCount => 2;
protected override int MaxHeroineCount => 4;
protected override bool IsHardSex => false;

protected override Animator GetFemaleAnimator(int girlIndex) =>
Expand All @@ -51,17 +52,19 @@ protected override Animator GetFemaleAnimator(int girlIndex) =>

protected override IEnumerator UntilReady(object instance)
{
yield return new WaitForSeconds(10f);
females = new[] { "chaF_00", "chaF_01" }
.Select(GameObject.Find)
.Where(go => go != null && go.active)
.Select(chara => (chara.transform.Find("BodyTop/p_cf_jm_body_bone_00")
?? chara.transform.Find("BodyTop/p_cf_jm_body_bone_00(Clone)")).gameObject)
yield return new WaitForSeconds(5f);
var humanType = Il2CppType.From(Type.GetType("Character.HumanComponent,Assembly-CSharp"));
var humans = FindObjectsOfType(humanType, false)
.Select(human => human.Cast<MonoBehaviour>().transform)
.ToArray();
penises = new[] { "chaM_00", "chaM_01" }
.Select(GameObject.Find)
.Where(go => go != null && go.active)
.Select(chara => FindDeepChildrenByPath(chara, "k_f_tamaC_00").First())
females = humans
.Where(tf => tf.name.StartsWith("chaF_"))
.Select(chara => (chara.Find("BodyTop/p_cf_jm_body_bone_00")
?? chara.Find("BodyTop/p_cf_jm_body_bone_00(Clone)")).gameObject)
.ToArray();
penises = humans
.Where(tf => tf.name.StartsWith("chaM_"))
.Select(chara => FindDeepChildrenByPath(chara.gameObject, "k_f_tamaC_00").First())
.ToArray();
}
}
20 changes: 10 additions & 10 deletions src/LoveMachine.HC/HoneyComeGame.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections;
using System.Reflection;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using LoveMachine.Core.Common;
using LoveMachine.Core.Game;
using UnityEngine;
Expand Down Expand Up @@ -62,21 +63,20 @@ protected override string GetPose(int girlIndex) =>

protected override bool IsOrgasming(int girlIndex) => nowOrgasm.Value;

protected override IEnumerator UntilReady(object hscene)
protected override IEnumerator UntilReady(object instance)
{
yield return new WaitForSeconds(10f);
ctrlFlag = Traverse.Create(hscene).Property("CtrlFlag");
var hscene = Traverse.Create(instance);
ctrlFlag = hscene.Property("CtrlFlag");
loopType = ctrlFlag.Property<int>("LoopType");
nowOrgasm = ctrlFlag.Property<bool>("NowOrgasm");
females = new[] { "chaF_00", "chaF_01" }
.Select(GameObject.Find)
.Where(go => go != null && go.active)
.Select(chara => chara.transform.Find("BodyTop/p_cf_jm_body_bone_00").gameObject)
females = hscene.Property<Il2CppReferenceArray<Transform>>("_chaFemalesTrans").Value
.Where(tf => tf != null && tf.gameObject.active)
.Select(chara => chara.Find("BodyTop/p_cf_jm_body_bone_00").gameObject)
.ToArray();
penises = new[] { "chaM_00", "chaM_01" }
.Select(GameObject.Find)
.Where(go => go != null && go.active)
.Select(chara => FindDeepChildrenByPath(chara, "k_f_tamaC_00").First())
penises = hscene.Property<Il2CppReferenceArray<Transform>>("_chaMalesTrans").Value
.Where(tf => tf != null && tf.gameObject.active)
.Select(chara => FindDeepChildrenByPath(chara.gameObject, "k_f_tamaC_00").First())
.ToArray();
}
}

1 comment on commit 2b8115e

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
12 0 0 12 100

Passed Tests

Name ⏱️ Duration Suite
Linear Command Count 0.002 s Secrossphere Demo Test Suite
Linear Command Timing 0.003 s Secrossphere Demo Test Suite
Linear Command Position 0.007 s Secrossphere Demo Test Suite
Linear Command Duration 0.001 s Secrossphere Demo Test Suite
Vibrate Command Count 0.009 s Secrossphere Demo Test Suite
Vibrate Command Timing 0.005 s Secrossphere Demo Test Suite
Rotate Command Count 0.002 s Secrossphere Demo Test Suite
Rotate Command Timing 0.008 s Secrossphere Demo Test Suite
Oscillate Command Count 0.001 s Secrossphere Demo Test Suite
Oscillate Command Speed 0.001 s Secrossphere Demo Test Suite
Battery Level 0.009 s Secrossphere Demo Test Suite
Kill Switch 6.036 s Secrossphere Demo Test Suite

Please sign in to comment.