public static void DarkChainDestroy(Item chain, RagdollPart ragdollPart, RagdollHandle ragdollHandle, Telekinesis telekinesis, bool neck) { telekinesis.TryRelease(); DestroySelf.Destroy(chain.gameObject); if (ragdollPart.ragdoll.parts.Count > 0) { foreach (RagdollPart part in ragdollPart.ragdoll.parts) { part.rb.isKinematic = false; } } if (ragdollHandle.ragdollPart.ragdoll.parts.Count > 0) { foreach (RagdollPart part in ragdollHandle.ragdollPart.ragdoll.parts) { part.rb.isKinematic = false; } } ragdollPart.ragdoll.SetState(BS.Ragdoll.State.Fallen); if (ragdollPart.ragdoll.creature.health.currentHealth <= 0) { ragdollPart.ragdoll.SetState(BS.Ragdoll.State.Dead); } if (ragdollHandle.name == "NPC(neck)(chained)") { ragdollHandle.name = "NPC(neck)"; } else if (ragdollHandle.name == "NPC(chained)") { ragdollHandle.name = "NPC"; } else { Debug.Log("The ragdollHandle was neither the neck nor a default part"); } //ragdollPart.ragdoll.RefreshFall(); ragdollPart.ragdoll.allowStandUp = true; ragdollHandle.tag = "Untagged"; }
public void OnTeleUnGrabAction(Handle handle, Telekinesis teleGrabber) { if (!teleUngrabbing) { teleUngrabbing = true; item.rb.isKinematic = true; if (!module.freezeEnemiesInTheAir) { teleGrabber.TryRelease(); isEnding = true; DarkChains.DarkChainDestroy(item, myRagdollPart, ragdollHandle, teleGrabber, neck); } if (neck && module.choking) { chokeSFX.Stop(); choking = false; NPC.OnChoke(false); NPC.speak.enabled = true; NPC.speak.speakLoudness = 1f; } } }
public void CheckTeleNPC(Telekinesis telekinesis) { if (telekinesis.catchedHandle != null) { if (telekinesis.catchedHandle.tag == "Untagged") { if (telekinesis.catchedHandle.name == "NPC" || telekinesis.catchedHandle.name == "NPC(neck)") { RagdollHandle rdHandle = telekinesis.catchedHandle as RagdollHandle; if (rdHandle.ragdollPart != null) { Item chain = Catalog.current.GetData <ItemData>("DarkChain", true).Spawn(true); rdHandle.ragdollPart.ragdoll.allowStandUp = false; chainedParts.Add(rdHandle); darkChains.Add(chain); chain.transform.position = rdHandle.ragdollPart.transf.position; chain.transform.rotation = rdHandle.ragdollPart.transf.rotation; if (chain.gameObject != null) { if (chain.gameObject.GetComponent <ItemDarkChain>() != null) { chain.gameObject.GetComponent <ItemDarkChain>().myRagdollPart = rdHandle.ragdollPart; chain.gameObject.GetComponent <ItemDarkChain>().ragdollHandle = rdHandle; } } if (telekinesis.catchedHandle.name == "NPC(neck)") { chain.gameObject.GetComponent <ItemDarkChain>().sliceable = false; chain.gameObject.GetComponent <ItemDarkChain>().neck = true; telekinesis.catchedHandle.name = "NPC(neck)(chained)"; } else { chain.gameObject.GetComponent <ItemDarkChain>().sliceable = true; chain.gameObject.GetComponent <ItemDarkChain>().neck = false; telekinesis.catchedHandle.name = "NPC(chained)"; } if (rdHandle.ragdollPart.ragdoll.state != BS.Ragdoll.State.Dead) { rdHandle.ragdollPart.ragdoll.SetState(BS.Ragdoll.State.Fallen); } chain.gameObject.GetComponent <ItemDarkChain>().Initialize(); Debug.Log("Catched handle name: " + telekinesis.catchedHandle.name); telekinesis.catchedHandle.tag = "IgnoreTK"; telekinesis.TryRelease(); telekinesis.targetHandle = chain.mainHandleRight; telekinesis.TryCatch(); } } } } }