mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-20 15:41:01 +00:00
aaa
This commit is contained in:
parent
db6dceec47
commit
f35613e23e
@ -1,5 +1,6 @@
|
||||
using QSB.Animation.NPC.WorldObjects;
|
||||
using QSB.Events;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.Animation.NPC.Events
|
||||
@ -26,9 +27,11 @@ namespace QSB.Animation.NPC.Events
|
||||
switch (message.AnimationEvent)
|
||||
{
|
||||
case AnimationEvent.StartConversation:
|
||||
DebugLog.DebugWrite($"Start conversation");
|
||||
qsbObj.StartConversation();
|
||||
break;
|
||||
case AnimationEvent.EndConversation:
|
||||
DebugLog.DebugWrite($"End conversation");
|
||||
qsbObj.EndConversation();
|
||||
break;
|
||||
}
|
||||
|
58
QSB/Animation/NPC/Patches/TravelerControllerPatches.cs
Normal file
58
QSB/Animation/NPC/Patches/TravelerControllerPatches.cs
Normal file
@ -0,0 +1,58 @@
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace QSB.Animation.NPC.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(TravelerController))]
|
||||
public class TravelerControllerPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(TravelerController.OnStartConversation))]
|
||||
public static bool OnStartConversation(TravelerController __instance)
|
||||
{
|
||||
DebugLog.DebugWrite($"{__instance.name} OnStartConversation");
|
||||
__instance._talking = true;
|
||||
|
||||
if (__instance._animator != null && __instance._animator.enabled)
|
||||
{
|
||||
__instance._playingAnimID = __instance._animator.IsInTransition(0)
|
||||
? __instance._animator.GetNextAnimatorStateInfo(0).fullPathHash
|
||||
: __instance._animator.GetCurrentAnimatorStateInfo(0).fullPathHash;
|
||||
|
||||
__instance._animator.SetTrigger("Talking");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(TravelerController.OnEndConversation))]
|
||||
public static bool OnEndConversation(TravelerController __instance)
|
||||
{
|
||||
DebugLog.DebugWrite($"{__instance.name} OnEndConversation");
|
||||
if (__instance._animator != null && __instance._animator.enabled)
|
||||
{
|
||||
if (__instance._delayToRestartAudio > 0f)
|
||||
{
|
||||
__instance._animator.CrossFadeInFixedTime(__instance._playingAnimID, __instance._delayToRestartAudio, -1, -__instance._delayToRestartAudio);
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance._animator.SetTrigger("Playing");
|
||||
}
|
||||
}
|
||||
|
||||
__instance._talking = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -32,9 +32,9 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
}
|
||||
|
||||
public override CharacterDialogueTree GetDialogueTree()
|
||||
=> AttachedObject.GetValue<CharacterDialogueTree>("_dialogueTree");
|
||||
=> AttachedObject._dialogueTree;
|
||||
|
||||
public override bool InConversation()
|
||||
=> AttachedObject.GetValue<bool>("_inConversation");
|
||||
=> AttachedObject._inConversation;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,8 @@ namespace QSB.Patches
|
||||
new LightSensorPatches(),
|
||||
new AnglerPatches(),
|
||||
new MeteorClientPatches(),
|
||||
new MeteorServerPatches()
|
||||
new MeteorServerPatches(),
|
||||
new TravelerControllerPatches()
|
||||
};
|
||||
|
||||
TypeToInstance = new Dictionary<QSBPatchTypes, Harmony>
|
||||
|
@ -53,6 +53,7 @@
|
||||
<Compile Include="Animation\NPC\Events\NpcAnimationMessage.cs" />
|
||||
<Compile Include="Animation\NPC\Patches\CharacterAnimationPatches.cs" />
|
||||
<Compile Include="Animation\NPC\Patches\SolanumPatches.cs" />
|
||||
<Compile Include="Animation\NPC\Patches\TravelerControllerPatches.cs" />
|
||||
<Compile Include="Animation\NPC\WorldObjects\INpcAnimController.cs" />
|
||||
<Compile Include="Animation\NPC\WorldObjects\NpcAnimController.cs" />
|
||||
<Compile Include="Animation\NPC\WorldObjects\QSBCharacterAnimController.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user