public static bool Prefix(ref BlockManager __instance, ref bool allowHeadlessTech, ref bool removeTechIfEmpty) { Tank tank = (Tank)IngressPoint.tank.GetValue(__instance); IngressPoint.FixupBlockRefs(__instance); if (!allowHeadlessTech && !tank.control.HasController && !tank.IsAnchored) { IngressPoint.HostRemoveAllBlocks(__instance, BlockManager.RemoveAllAction.ApplyPhysicsKick); } if (__instance.blockCount == 0) { d.Assert(tank.blockman.blockCount == 0); tank.EnableGravity = false; } return(false); }
private static void HostRemoveAllBlocks(BlockManager __instance, BlockManager.RemoveAllAction option) { d.Assert(ManNetwork.IsHost, "Can't call HostRemoveAllBlocks on client"); Tank tank = (Tank)IngressPoint.tank.GetValue(__instance); if (ManNetwork.IsNetworked && tank.netTech != null) { RemoveAllBlocksMessage message = new RemoveAllBlocksMessage { m_Action = option }; Singleton.Manager <ManNetwork> .inst.SendToAllExceptClient(-1, TTMsgType.RemoveAllBlocksFromTech, message, tank.netTech.netId, true); IngressPoint.RemoveAllBlocks(__instance, option); return; } IngressPoint.RemoveAllBlocks(__instance, option); }