public static void Detach_Prefix(DetachableFragment __instance, out FragmentIntegrity __state) => // this gets set to null in Detach, so store it here and and then restore it in postfix __state = __instance._fragmentIntegrity;
public static void Detach_Postfix(DetachableFragment __instance, FragmentIntegrity __state) => __instance._fragmentIntegrity = __state;
public static bool ItemTool_DropItem(RaycastHit hit, OWRigidbody targetRigidbody, DetachableFragment detachableFragment, ref OWItem ____heldItem) { Locator.GetPlayerAudioController().PlayDropItem(____heldItem.GetItemType()); var hitGameObject = hit.collider.gameObject; var gameObject2 = hitGameObject; var sectorGroup = gameObject2.GetComponent <ISectorGroup>(); Sector sector = null; while (sectorGroup == null && gameObject2.transform.parent != null) { gameObject2 = gameObject2.transform.parent.gameObject; sectorGroup = gameObject2.GetComponent <ISectorGroup>(); } if (sectorGroup != null) { sector = sectorGroup.GetSector(); } var parent = (detachableFragment != null) ? detachableFragment.transform : targetRigidbody.transform; var objectId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(____heldItem)); ____heldItem.DropItem(hit.point, hit.normal, parent, sector, detachableFragment); ____heldItem = null; Locator.GetToolModeSwapper().UnequipTool(); var parentSector = parent.GetComponentInChildren <Sector>(); if (parentSector != null) { var localPos = parentSector.transform.InverseTransformPoint(hit.point); QSBEventManager.FireEvent(EventNames.QSBDropItem, objectId, localPos, hit.normal, parentSector); return(false); } DebugLog.ToConsole($"Error - No sector found for rigidbody {targetRigidbody.name}!.", MessageType.Error); return(false); }