Skip to content

Commit

Permalink
Fix bugs with Mantis Lords
Browse files Browse the repository at this point in the history
  • Loading branch information
Extremelyd1 committed Jul 12, 2024
1 parent 7695736 commit 8e9cc13
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Hkmp.Game.Client.Entity.Component;

/// <inheritdoc />
/// This component manages the gravity scale of an entity.
/// This component manages the activation of the children of an entity.
internal class ChildrenActivationComponent : EntityComponent {
private readonly List<GameObject> _hostChildren;
private readonly List<GameObject> _clientChildren;
Expand Down Expand Up @@ -80,4 +80,4 @@ public override void Update(EntityNetworkData data) {
public override void Destroy() {
MonoBehaviourUtil.Instance.OnUpdateEvent -= OnUpdate;
}
}
}
7 changes: 4 additions & 3 deletions HKMP/Game/Client/Entity/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ private void ObjectPoolOnRecycleGameObject(On.ObjectPool.orig_Recycle_GameObject
/// </summary>
private void OnDoActivateGameObject(ActivateGameObject.orig_DoActivateGameObject orig, HutongGames.PlayMaker.Actions.ActivateGameObject self) {
// If the game object in the action is not our host game object, we skip it
if (self.Fsm.GetOwnerDefaultTarget(self.gameObject) != Object.Host) {
if (self.Fsm.GetOwnerDefaultTarget(self.gameObject) != Object.Host || Object.Host == null) {
orig(self);
return;
}
Expand Down Expand Up @@ -951,9 +951,10 @@ public void MakeHost() {

// We need to set the isKinematic property of rigid bodies to ensure physics work again after enabling
// the host object. In Hornet 1 this is necessary because another state sets this property normally in the
// fight. See the "Wake" or "Refight Ready" state of the "Control" FSM on Hornet 1
// fight. See the "Wake" or "Refight Ready" state of the "Control" FSM on Hornet 1.
// In the Mantis Lord entity, this should never be disabled, since they are always kinematic.
var rigidBody = Object.Host.GetComponent<Rigidbody2D>();
if (rigidBody != null) {
if (rigidBody != null && Type != EntityType.MantisLord) {
Logger.Debug(" Resetting isKinematic of Rigidbody to ensure physics work for host object");
rigidBody.isKinematic = false;
}
Expand Down
3 changes: 2 additions & 1 deletion HKMP/Game/Client/Entity/EntityInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ internal static class EntityInitializer {
/// Array of types of actions that should be skipped during initialization.
/// </summary>
private static readonly Type[] ToSkipTypes = {
typeof(Tk2dPlayAnimation)
typeof(Tk2dPlayAnimation),
typeof(ActivateAllChildren)
};

/// <summary>
Expand Down

0 comments on commit 8e9cc13

Please sign in to comment.